Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
dingoman

Load image into Sprite

Recommended Posts

Hi,

 

I try to load into an image into a sprite with this lines of code

var loader:ImageLoader = new ImageLoader(url, {name:"picture", container:spr, scaleMode:"proportionalInside",onComplete:onImageLoad});
loader.load();

 

It's looks like that the image is getting inside the sprite ( only X and Y pos ) but all the properties like scalemode aren't working.

 

also when I try to removeChildAt form my the sprite flash throw an error that say that the sprite have no children.

 

what can I do?

 

Thanks...

Link to post
Share on other sites

In order for the scaleMode to work, you must define a "width" and a "height" (otherwise it doesn't know what size to fit into). You could set those values to your Sprite's if you want.

 

var loader:ImageLoader = new ImageLoader(url, {name:"picture", container:spr, width:spr.width, height:spr.height, scaleMode:"proportionalInside", onComplete:onImageLoad});
loader.load();

 

As far as the removeChildAt() error, I'd need to see your file to know what's happening. Feel free to post it here so that we can publish. Are you sure you're calling that method on the correct object and the correct index?

Link to post
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.

×