Style through namespace in Flex4


 

Style through namespace in Flex4

In this example we have apply style property through corresponding components.

In this example we have apply style property through corresponding components.

Style in Flex4 through <fx:Style> tag:-

In this example we have apply style property through corresponding components. User can see we have create Text and Link button components and create style for a particular components in the <fx:Style> tag. If user want to apply this process for components it is used namespace for the related library.

Example:-

<?xml version="1.0"?>

<s:Application

xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:mx="library://ns.adobe.com/flex/mx"

xmlns:s="library://ns.adobe.com/flex/spark">

<fx:Style>

@namespace mx "library://ns.adobe.com/flex/mx";

mx|Text {

fontSize: 12;

color: green;

}

mx|LinkButton {

fontSize: 12;

color: #00CCFF;

}

</fx:Style>

<s:VGroup>

<mx:Text text="This is text control in Flex4."/>

<mx:LinkButton label="My Link Button"/>

</s:VGroup>

</s:Application>

Output:-

In this example we have create a text and link button and create corresponding class for these components. These styles are applies all the text and link button components in the application.

Download this code

Ads