Jump to content
GreenSock

attaboy

why is nothing displaying?

Recommended Posts

I copied the code for ImageLoader_Enhanced class form a LoaderMax tutorial I found on the GreenSock site

this is the code:

package com.demos {

import com.greensock.loading.ImageLoader;
import flash.display.Sprite;

public class ImageLoader_Enhanced extends Sprite {

	public function ImageLoader_Enhanced() {
		var image:ImageLoader = new ImageLoader("bio_pics/0001.jpg",
												 {container:this,
												 	x:30, y:100,
													width:750, height:350,
													scaleMode:"proportionalInside",
													centerRegistration:true,
													blendMode:"overlay",
													bgColor:0x000000,
													rotation:0});
		image.load();
	}
}
}

 

I created a folder in my com folder called demos and put it there as ImageLoader_Enhanced.as

I then created a Fla in the same folder as the com and bio_pics folders. In that FLA I run this code:

 

import com.demos.*;

var displayImage:ImageLoader_Enhanced = new ImageLoader_Enhanced();
displayImage;

 

I get no error message so I guess it works but no image is displayed.

Link to comment
Share on other sites

That class was intended to be used as the Document class of your FLA, but if you want to use it separately like that, you just need to add it to the display list. In other words, your code was creating a Sprite but you never saw it because you never did addChild() on the stage. See what I mean?

 

Remember, there are sample .fla files in the stuff you downloaded.

Link to comment
Share on other sites

oops that was dumb.

I changed to this

 

import com.demos.*;

 

var displayImage:ImageLoader_Enhanced = new ImageLoader_Enhanced();

addChild(displayImage);

 

but still nothing.

I also tried as a document class, same blank screen.

 

it would be nice if there were demo fla's

Link to comment
Share on other sites

it would be nice if there were demo fla's

Ummm....there are. Did you see the link towards the top of the page at http://www.greensock.com/loadermax-video/? That gets you all the demo files so you can just crack 'em open and publish to your heart's content.

 

If you're still having trouble, please post your FLA and any associated support files here and I'd be happy to take a peek.

Link to comment
Share on other sites

cool this is better than Christmas.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×