Flex Style Manager


 

Flex Style Manager

In this tutorial, user can see how to use Style Manager for implement style in flex application.

In this tutorial, user can see how to use Style Manager for implement style in flex application.

StyleManager in Flex:-

In this tutorial, user can see how to use Style Manager for implement style in flex application. First, we discuss what is StyleManager in flex?. The class mx.styles.StyleManager define the StyleManager which manage all styles on all components instance. The StyleManager main task are manage style for each component instance. In this example StyleManager are use two methods that's getStyleDeclaration() and setStyle() to set Style for flex components. The getStyleDeclaration() method are use to to find out the graphical component and setStyle() method are use to set Style for the flex components. for example,

<?xml version="1.0"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()">

<mx:Script><![CDATA[

import mx.skins.Border;

import mx.styles.StyleManager;

public function initApp():void {

StyleManager.getStyleDeclaration("LinkButton").setStyle("fontSize",10);

StyleManager.getStyleDeclaration("LinkButton").setStyle("fontWeight","bold");

StyleManager.getStyleDeclaration("LinkButton").setStyle("color",0xEEEEEE);

StyleManager.getStyleDeclaration("Button").setStyle("fontSize",10);

StyleManager.getStyleDeclaration("Button").setStyle("fontWeight","bold");

StyleManager.getStyleDeclaration("Button").setStyle("color",0xEEEEEE);

StyleManager.getStyleDeclaration("Image").setStyle("borderThickness",10);

StyleManager.getStyleDeclaration("Image").setStyle("borderThickness",10);

}

]]></mx:Script>

<mx:LinkButton id="myLinkButton" label="This is my Link Button."/>

<mx:Button id="myButton" label="This is my Button."/>

<mx:Image id="img" source="@Embed(source='assets/flower.jpeg')"/>

</mx:Application>

Output:-

 

Ads