getting measured image size after maintainAspectRatio

Posted on 2008-11-18
Medium Priority
Last Modified: 2012-05-05
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 :)
Question by:yyyannag

Expert Comment

ID: 22987379
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"/>

Open in new window


Accepted Solution

yyyannag earned 0 total points
ID: 23172179
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 :)

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question