You can use the styleManager for set the style of component.
You can use the styleManager for set the style of component.You can use the styleManager for set the style of component. In this example we use a styleManager for set the property of components. The syntax is following:
styleManager.getStyleDeclaration(style_name).setStyle("property", value);
We have to use a getStyleDeclaration() method. you can use the three type of selector in it: Type Selector, Class Selector and Global Style.
|
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s=" library://ns.adobe.com/flex/spark"xmlns:mx=" library://ns.adobe.com/flex/mx"minWidth=" 955" minHeight="600"creationComplete="init()" > <fx:Style>} </fx:Style> <fx:Script><![CDATA[ public function init():void{ // set style using style managerstyleManager.getStyleDeclaration( "spark.components.Button").setStyle("fontSize",15);styleManager.getStyleDeclaration( "spark.components.Button").setStyle("color", "blue");} ]]> </fx:Script> <s:Panel title="Style using Style manager Example" width="288" height="182">label=" Submit"x=" 85" y="31"/>x=" 34" y="84" styleName="label"/> </s:Panel></s:Application> |

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.