Dynamically to change the icon of a Button, you can use the following code and its simple and small.
For Example in MXML There’s a Button:
<Button id=”btn” icon=”@Embed(images/icon1.png)” />
Then to change the Icon for the Above Button in AS use the Following code in Script Tag:
public var iconSymbol:Class;
btn.setStyle(“icon”,iconSymbol); —>This will change the icon.
This change can be made on an Event like click on another Button.
Click here to view the Example of it.
Think Dynamically, Enjoy the Post.Comments are welcome.
Download code here