Jump to content


Thumbnails with same space between them

Moderator Tag

Recommended Posts



I'm making a simple gallery with a line of thumbnails.

But thumbnails are NOT the same size, and some of them are in a vertical format

(excuse my bad english !)


I put the bgAlpha to zero, but there's a big space around thumbnails, when there're in vertical format, because of the ContentDisplay width.


In fact i would like that, when the thumbnail is loaded, the ContentDisplay width is the same as the thumbnail.


I did that :


function childCompleteHandler(evt:LoaderEvent):void { 
var image:ContentDisplay = evt.target.content;
image.width = image.rawContent.width;


But there's still a space around vertical thumbnails..

any idea ?


Is it possible to resize a picture only with the height ? So that the picture is exactly X px height, and the width is ok with the ratio.



thanks !

Link to comment
Share on other sites

I assume you defined a width and height on your ImageLoader(s), right? That causes ContentDisplay to draw that rectangle in its graphics layer/object accordingly and then when the image loads, it fits it inside that area. Currently, you cannot only define a height or width - you must define both or none but you can simply clear or redraw the graphics inside the ContentDisplay after the image loads if you want. Like:




If you want to make sure the loaded image's top left corner is aligned with the ContentDisplay's registration point, don't forget to do this too:


myLoader.rawContent.x = myLoader.rawContent.y = 0;

Link to comment
Share on other sites

Thank you !


that worked perfectly :)


Anyway, an option to resize a picture with ratio only from width or height would be appreciated !

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.