SstyleName property example in Flex4


 

SstyleName property example in Flex4

If user want to apply the style properties in a single component then user use styleName properties for particular component.

If user want to apply the style properties in a single component then user use styleName properties for particular component.

StyleName Property for Style in Flex4:-

If user want to apply the style properties in a single component then user use styleName properties for particular component.

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>

.textFontStyle {

fontSize: 15;

color: #00CCFF;

font-weight:bold;

font-thickness:10;

}

</fx:Style>

<s:VGroup>

<mx:Text id="text1" text="This is text control with Style in Flex4." styleName="textFontStyle"/>

<mx:Text id="text2" text="This is text control without Style in Flex4."/>

</s:VGroup>

</s:Application>

In this example we have create two text components one is with styleName property and other is without styleName property. And create a style class name is textFontStyle, which is include font  related properties and color for the text. User can see these style class apply for the components that use styleName property and other text component are create simply without style.

Output:-strong>

Download this code

Ads