Home Tutorial Flex Flex4 Components RichText in Flex4

 
 

Share on Google+Share on Google+
RichText in Flex4
Posted on: April 24, 2010 at 12:00 AM
Advertisement
In Flex4 RichText Control is a Spark Control and it is a middleweight Component. The text shown in richly-formatted text, with multiple character and paragraph formats.

RichText in Flex4:

In Flex4 RichText Control is a Spark Control and it is a middleweight Component. The text shown in richly-formatted text, with multiple character and paragraph formats. It is not a interactive component because in which you can't define the property such as hyperlinks, scrolling, selection, or editing. If you want to use these properties you can use the RichEditableText control. You can use the textFlow, text, and content properties For specifying the text in the RichText control. You can set the alignment of text as horizontally and vertically but it can't be scrolled.

The tag of RichText Control is <s:RichText>. You can set the property with in the tag.

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

<fx:Script>

<![CDATA[

public function fun():void{

ricTxt.text+=txtInput1.text;

}

public function clear():void{

txtInput1.text="";

ricTxt.text="";

}

]]>

</fx:Script>

<s:Panel title="RichText Example" width="400" height="200" color="#990000">

<s:HGroup paddingLeft="2" paddingTop="2">

<s:Label text="Please enter the text in TextInput and click on submit Button" color="Red">

</s:Label>

</s:HGroup>

<s:HGroup paddingLeft="20" paddingTop="20" horizontalCenter="3">

<s:VGroup>

<s:TextInput id="txtInput1">

</s:TextInput>

<s:Button id="btn" label="Submit" click="fun()">

</s:Button>

<s:Button id="btn1" label="Clear" click="clear()">

</s:Button>

</s:VGroup>

<s:Group x="100" y="0">

<s:RichText id="ricTxt"

width="100"

height="100"

paddingTop="2"

paddingLeft="2"

color="#990000"

lineBreak="toFit"/>

<s:Rect width="100%" height="100%">

<s:stroke>

<s:SolidColorStroke color="blue"/>

</s:stroke>

</s:Rect>

</s:Group>

</s:HGroup>

</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 RichText 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 24, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com