Share on Google+Share on Google+

SstyleName property example in Flex4

Advertisement
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

Advertisements

Advertisement

Posted on: June 1, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.