getting measured image size after maintainAspectRatio

Posted on 2008-11-18
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
    LVL 7

    Expert Comment

    something like this?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="" 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

    LVL 2

    Accepted Solution

    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 :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    Title # Comments Views Activity
    LinkList not supported? 8 288
    Adobe live streaming 8 685
    Flex SDK setup 1 334
    air/as3 : is there a way to simulate TouchEvents? 1 387
    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…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    This video discusses moving either the default database or any database to a new volume.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now