Jump to content
GreenSock

mrEmpty

Loading an image and applying a drop shadow

Recommended Posts

Using ImageLoader to grab an image and place it into sprite container...

 

pageImageLoader.append( new ImageLoader(pageImage, {name:"mainImage", container:imageBox, scaleMode:"proportionalOutside", crop:true, width:520, height:685}) );
   pageImageLoader.load();

 

is causing me problems if I set the size of the sprite (imageBox) immediately before performing the load.

 

I need to have a drop shadow on the images (not created in the image itself sadly) so I'm applying a drop shadow filter tot he sprite that I load the image into. I set the size of the sprite to be the size of the image loaded, load the image, but then the loaded image is stretched out vertically. So whilst the above code works, this code wont:

 

imageBox.width = 520;
   imageBox.height = 685;
   pageImageLoader.append( new ImageLoader(pageImage, {name:"mainImage", container:imageBox, scaleMode:"proportionalOutside", crop:true, width:520, height:685}) );
   pageImageLoader.load();

 

Any ideas?

 

Thanks.

Link to comment
Share on other sites

yeah, i don't think you should set the width and height of an empty element, in this case your imageBox. When you alter the size of a container directly, all children get resized as well.

 

when you do

 

imageBox.width = 520

you are stretching imageBox to be 520px wider than it normally is and thus its children get stretched when they are added.

 

instead of setting width and size, draw an invisible Shape into the sprite with the width and height that you need.

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.
×