Toggle button font size between null and 8
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
public function toggleStyle():void {
if (cb1.selected == true) {
b1.setStyle("fontSize", 8);
} else {
b1.setStyle("fontSize", null);
}
}
</mx:Script>
<mx:Style>
@namespace mx "http://www.adobe.com/2006/mxml";
mx|Button {
color: red;
fontSize: 25;
}
</mx:Style>
<mx:Button id="b1" label="Click Me" />
<mx:CheckBox id="cb1" label="Set Style/Unset Style" click="toggleStyle()" selected="false" />
</mx:Application>
Related examples in the same category