Mega Code Archive

 
Categories / Flex / Style
 

Use setStyle to change font style

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">     <mx:Script>     public function changeLabel(s:String):void {         s = "myButton" + s;         this[s].setStyle("fontStyle","italic");         this[s].setStyle("fontSize","18");     }   </mx:Script>     <mx:Button id="myButton1" click="changeLabel('2')" label="Change Other Button's Styles" />     <mx:Button id="myButton2" click="changeLabel('1')" label="Change Other Button's Styles" /> </mx:Application>