I think you just want minWidth/minHeight=0, no width/height attributes,
or maxWidth/Height attributes.

 

Keep in mind that loading is asynchronous and the measuredWidth/Height
are not valid until after the image loads.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Amy
Sent: Tuesday, February 12, 2008 3:16 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Constraining image size

 

Hi, all;

I have the situation where I have an image control I am using in a 
component. I want the image to be able to be as big as it can up to 
the actual file size, so I have given the image control a width of 
100%, scalecontent = true, maintainaspectratio=true. However, this 
is only _close_ to what I want it to do. What I _actually_ want it 
to do is to scale the content only if the content needs to be scaled 
_down_ to fit in the container. Otherwise, I want it to max out at 
the natural width of the image, so I don't get nasty pixellated 
images. I've tried using this:

<mx:Image id="imgCtrl" maintainAspectRatio="true" 
source="{'images/'+_img}" 
scaleContent="true" height="100%" 
width="100%" 
maxWidth="{imgCtrl.measuredWidth}"
completeEffect="Fade"
verticalAlign="bottom" 
horizontalAlign="center" />

but the image fails to appear, presumably because somehow the 
measuredWidth is 0.

Any ideas?

Thanks;

Amy

 

Reply via email to