Use getStyle() and setStyle() to change the Button's fontSize style
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
public function showStyles():void {
lb1.text = String(ip1.getStyle("fontSize"));
}
public function setNewStyles(newSize:Number):void {
ip1.setStyle("fontSize",newSize);
}
</mx:Script>
<mx:VBox id="vb">
<mx:TextInput styleName="myClass" text="My attrs" id="ip1" width="400" />
<mx:Label id="lb1" text="" width="400" />
<mx:Button label="Get Style" click="showStyles();" />
<mx:Button label="Set Style" click="setNewStyles(Number(ip2.text));" />
<mx:TextInput text="" id="ip2" width="50" />
</mx:VBox>
</mx:Application>
Related examples in the same category