Thanks gordon. Just what I needed.

Hank

On 10/24/06, Gordon Smith <[EMAIL PROTECTED]> wrote:

When the image has been completely loaded, you get a 'complete' event. At that point the contentWidth and contentHeight properties contain the natural size of the image. You can use these to set the Image's size to be some fraction of the natural size:

 

    private function completeHandler(event:Event):void

    {

        image.width = 0.5 * image.contentWidth;

        image.height = 0.5 * image.contentHeight;

    }

 

- Gordon

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of hank williams
Sent: Tuesday, October 24, 2006 4:44 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How to discover the natural dimensions of a loaded image

 

When I load an image, I would love to be able to set the width and
have the height be set appropriately. This does happen on the screen -
the image is scaled to the given width and the height is scaled on the
screen. But the height on the page is not scaled and so, in a VBox for
example, the height pushes everything else way off the screen.

This means I need to figure out the ratio between the width and
height, and then set the width and height accordingly, but I can't
figure out how to access that info. Any insight would be appreciated.

Hank


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to