Home Tutorial Flex Flex4 Components Label in Flex4

 
 

Share on Google+Share on Google+
Label in Flex4
Posted on: April 21, 2010 at 12:00 AM
Advertisement
In Flex4 Label is a lightweight and low level UI-component that is known as Spark Component in FLex4.

Label in Flex4:

In Flex4 Label is a lightweight and low level UI-component that is known as Spark Component in FLex4. Spark Label is used for rendering one or more lines of uniformly-formatted text. Label in Flex4 utilize the new Flash Text Engine (FTE) in Flash Player 10 to provide a high-quality international typography. Label is mostly suitable for use cases that involves many small pieces of non-interactive text.

Spark Label displays text with uniform formatting and in multiple of lines but it has limited capabilities like no complex formatting, no scrolling, no selection, no editing, and no hyperlinks. By default label has no background properties but you can change the properties of Label control using CSS or  in the label tag.  In spark Label three types of character sequences are used for line breaking explicitly which are:

CR(Carriage Return)  "\r"  
LF(Line Feed) "\n"    
CR+LF

"\r\n"  

 The tag of Spark Label is <s:Label>.....</s:Label>.

Example:

<?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">

<fx:Declarations>

<!-- Place non-visual elements (e.g., services, value objects) here -->

</fx:Declarations>

<fx:Script>

<![CDATA[

public function clr():void{

lbl.text="This is a Label Demo";

}

]]>

</fx:Script>

<s:Panel title="Label Controle Example"

width="30%" height="30%" x="311" y="10">

<s:VGroup x="102" y="37">

<s:Button id="btn" label="Click me" click="clr()"/>

<s:Label id="lbl"/>

</s:VGroup>

</s:Panel>

</s:Application>

Output:





Running Application:

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

Download this code

Advertisement

Related Tags for Label in Flex4:


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.

Posted on: April 21, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com