Yordan Yanakiev
Yordan Yanakiev

Reputation: 2604

Get width and height of embed image in Flex?

I have the follow declaration :

[Embed(source="i/6.png")]
private var img6 : Class;

Upvotes: 0

Views: 1005

Answers (1)

Constantiner
Constantiner

Reputation: 14221

You can determine size of embed image only on instantiation. Something like:

<s:BitmapImage source="{img6}" complete="completeHandler(event)" />
…
private function completeHandler(event:Event):void
{
    var image:BitmapImage = BitmapImage(event.currentTarget);
    trace (image.sourceWidth);
    trace (image.sourceHeight);
}

Upvotes: 1

Related Questions