11/30/2009 12:13:20 AM
Title:
how to get a button from flash in flex
im using button instead of movieclip in flsh file. how to get a button in flex using swf file. give me a sample code
11/30/2009 1:18:58 AM
you can use any component as button by just adding click listener. To use swf file as button load a swf file using swfloader component in flex and use its click event to do anything like button .
11/30/2009 1:54:58 AM
you can use css class to set skins for button and apply your swf as skin on button. Using this method you can give all the rollOver, RollOut press etc effects using swf file.
you can use css class like this
.testButton {
upSkin: Embed(source="testTheme.swf", symbol="btn_icon");
overSkin: Embed(source="testTheme.swf", symbol="btn_hover");
downSkin: Embed(source="testTheme.swf", symbol="btn_down");
selected-up-skin:Embed(source="testTheme.swf", symbol="btn_down");
selected-over-skin:Embed(source="testTheme.swf", symbol="btn_down");
selected-down-skin: Embed(source="testTheme.swf", symbol="btn_down");
disabledSkin: Embed(source="testTheme.swf", symbol="btn_dis");
selected-disabled-icon:Embed(source="testTheme.swf", symbol="btn_dis");
selected-disabled-skin:Embed(source="testTheme.swf", symbol="btn_dis");
}
In the above class the "testimony.swf" is your swf file and symbol names are library linkages of movieclips that you created for different states of button.