[flexcoders] How to get image width/height ???

2008-04-24 Thread Jason The Saj
Approximate example

[Embed(source=images/myphoto.png)]
[Bindable]
public var MyPhoto:Class;

var myImage:Image = new Image();
myImage.source = MyPhoto;
trace(myImage.width);

For whatever reason, I just get 0. I've tried contentWidth,
maxWidth, explicitWidth.

I've tried callLater and then attempted to get the width.

Any advice or guidance would be greatly appreciated!

- Jason




Re: [flexcoders] How to get image width/height ???

2008-04-24 Thread Eric Cancil
image.addEventListener(Event.COMPLETE, onLoad);

private function onLoad(e:Event):void{
trace(image.contentHeight);
}

On Thu, Apr 24, 2008 at 5:32 PM, Jason The Saj [EMAIL PROTECTED]
wrote:

   Approximate example

 [Embed(source=images/myphoto.png)]
 [Bindable]
 public var MyPhoto:Class;

 var myImage:Image = new Image();
 myImage.source = MyPhoto;
 trace(myImage.width);

 For whatever reason, I just get 0. I've tried contentWidth,
 maxWidth, explicitWidth.

 I've tried callLater and then attempted to get the width.

 Any advice or guidance would be greatly appreciated!

 - Jason