getting measured image size after maintainAspectRatio

Hello all

I have a canvas with the dimensions of 350*350. Inside I have an image loaded which is somewhat about 1000*800, and I use te maintainAspectRatio for it, to match the canvas dimensions.

Is there any way to know the new dimensions or the scaling ratio of the displayed image?

Thanks :)
LVL 2
yyyannagAsked:
Who is Participating?
 
yyyannagAuthor Commented:
evcr - no, because you didn't limit the canvas to a size...

Anyway, I found the solution, I used the image bitmapData to get the actual displayed width and height :)
0
 
evcrCommented:
something like this?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
	<mx:Canvas left="10" right="10" bottom="10" top="10">
		<mx:Image left="0" right="0" top="0" bottom="0" id="myimg" scaleContent="true" autoLoad="true" maintainAspectRatio="true"/>
		<mx:Label x="10" y="10" text="{'Image Scale Ratio:'+myimg.width /350}" width="279"/>
	</mx:Canvas>
</mx:Application>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.