When setting color style properties with the setStyle() method, you can use the hexadecimal format or the VGA color name, as the following example shows:
try out this <?xml version="1.0"?> <!-- styles/ColorFormatStyleManager.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()"> <mx:Script><![CDATA[ public function initApp():void { StyleManager.getStyleDeclaration("Button"). setStyle("themeColor",0x6666CC); StyleManager.getStyleDeclaration("Button"). setStyle("color","Blue"); } public function changeStyles(e:Event):void { // Check against "255" here, because that is the numeric value of "Blue". if (e.currentTarget.getStyle("color") == 255) { e.currentTarget.setStyle("themeColor", 0xFF0099); e.currentTarget.setStyle("color", "Red"); } else { e.currentTarget.setStyle("themeColor", 0x6666CC); e.currentTarget.setStyle("color", "Blue"); } } ]]></mx:Script> <mx:Button id="myButton" label="Click Here" click="changeStyles(event)" /> </mx:Application> On May 12, 2:40 pm, Gerald Anto <[email protected]> wrote: > can anyone say how to get dynamic colors in Action script. > initially my button text has one color then every click of button the > color should be changed. > for example intially my color is 0x00FF00 then it has to change > blue,red,green(any colors) etc. > > Thanks&Regards, > Gerald A --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

