Button doesn't carry the extra code to load external images.  You can
write a subclass that does.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of flashcrow2000
Sent: Monday, June 04, 2007 7:44 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Buttons with dynamic loaded images

 

Hello everybody,

I have the next problem: I'm trying to build a field containing a
Button/SimpleButton and a LinkButton. I also have an XML file which
points, for each entry, to a text, an URL, and three pictures, one for
each button state: up, over, down. 

I'm having trouble displaying a button with a dynamic loaded picture.
If I ebed them, it works ok. I've tried using the Image class, with an
event listener to catch when the picture loaded completely and then
adding it to the button, still nothing.
This is the button declaration:

<display:SimpleButton 
id="btn" 
mouseOver="onBtnOver()" 
mouseOut="onBtnOut()" 
/>

and this are the actions i'm using:

public var upState:Image = new Image();
public var upStateString:String = null;
private function onInit():void {
upState.load(upStateString);
upState.addEventListener(Event.COMPLETE, onImageComplete)
}

private function onImageComplete(event:Event) : void {
btn.upState = DisplayObject(upState);
}

Any ideas? Please :D
thanks!

 

Reply via email to