Jump to content

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

ImageLoader dimensions and LiquidArea

Recommended Posts



I've got a problem using LiquidArea and ImageLoader simultaneously.


ImageLoader uses a width and height that define a container for the image to load in.


I use it that way :

new ImageLoader(_urlImage, {name:"image"+_slides.length, width:_IMAGE_LARGEUR, height:_IMAGE_HAUTEUR, scaleMode:"proportionalInside", estimatedBytes:100000, onFail:_imageErreurHandler})


_IMAGE_LARGEUR and _IMAGE_HAUTEUR are the max value the image can have


I add an imagesContainer to the stage

_imagesContainer = new Sprite();

addChildAt(_imagesContainer, 0);


I use this _imagesContainer to add imageLoader.content to it


I created a LiquidArea to adjust images for a stage resize

var area:LiquidArea = new LiquidArea(this, 0, 0, _IMAGE_LARGEUR, _IMAGE_HAUTEUR, 0xEEEEEE);

area.preview = true;




On resize, the liquidArea is not taking my Image (that can be a landscape or portait ratio) but the size of the imageLoader dimensions (that are the max one, width and height)


Is there a way for the LiquidArea to take the useful dimensions of my image and not the entire imageLoader container dimensions ?




Link to comment
Share on other sites

if you want the natural size of the image (before it gets scaled or cropped by ImageLoader or any other mechanism) use




does that help?

Link to comment
Share on other sites

If I understand your description properly, it sounds like the problem has to do with the fact that you're trying to use two different tools to control the size of your object and they're conflicting. You defined a width/height on your ImageLoader which causes it to create that rectangle in the ContentDisplay object and then scale your image into that area, but keep in mind that the rectangle still exists (that's very intentional - it is quite useful for hit detection, rollovers, etc. even before the image has loaded). Then you're using a LiquidArea to scale that ContentDisplay which probably has gaps on the top/bottom or left/right depending on the orientation of your image. So both tools are doing exactly what you're asking them to do. Why not just let LiquidArea do the scaling (don't set a width/height on your ImageLoader)?

Link to comment
Share on other sites

Thanks greensock, I just remove the width and height from my imageLoader and LiquidArea is doing the job.


Indeed, the job was made twice from each tool.


I've just to center my image the first time on the stage.




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.