Is there a way to change a button icon programmatically? Yes,
using the setStyle method.
<?xml version="1.0"?>
<!-- skins/EmbedWithSetStyle.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()">
<mx:Script><![CDATA[
[Embed("../assets/orb_over_skin.gif")]
public var os:Class;
[Embed("../assets/orb_down_skin.gif")]
public var ds:Class;
[Embed("../assets/orb_up_skin.gif")]
public var us:Class;
private function init():void {
b1.setStyle("upSkin",us);
b1.setStyle("overSkin",os);
b1.setStyle("downSkin",ds);
}
]]></mx:Script>
<mx:Button label="Click Me" id="b1"/>
</mx:Application>
Is there a way to change a button icon with an image loaded at
runtime (non-embedded). There's no easy way, but if that's what you're looking
for send me an email and I'll send you some code to try. I'll probably blog
about a solution for this soon.
Ben Stucki
-------------------------------
We're Hiring! Seeking a passionate developer to join our team building Flex
based products. Position is in the Washington D.C. metro area. If interested
contact [EMAIL PROTECTED]
----------------------------------------
From: "richmcgillicuddy" <[EMAIL PROTECTED]>
Sent: Tuesday, February 06, 2007 8:57 AM
To: [email protected]
Subject: [flexcoders] Change Button Icon Programatically
is there a way to do this?
Rich