views:

32

answers:

2

I'm trying to create in Flex a Tile view that shows some images that a user has. The images don't have the same size, some are small and some are big.

What I'm trying to do is to use a List and create an ItemRenderer that has an Image property which displays the user images (the images are passed to the source property of the Image Object), I want the big images to scale down to the size of the tile so I set the 'scaleContnet' property of the Image Object to true, but this causes the small images to scale up to the size of the tile, this is not the behavior I want.

all the images are Embeded into Class objects and are passed as arguments to the ItemRenderer, how can I know in the ItemRenderer if I need to set the 'scaleContnet' property of the Image Object to true (for big images) or false (for small images)?

A: 

Untested, but give this a go:

<mx:Image id="img" scaleContent="{img.contentWidth > img.width || img.height > img.height}"/>
Wade Mueller
doesn't work good, the big pictures are scaled down but not properly (like when you set the property value to true from the begining)
Define "not properly", is the aspect ratio wrong, or does the image look bad? If the former, set maintainAspectRatio to true. If the latter, try setting smoothBitmapContent to true. Hope that helps.
Wade Mueller
A: 

I say specify width and height inside your tag. like <mx:Image width="100" height="200" source="XXX" /> This would restrict your image size to 100 width and 200 height.

Jerry