RichText in Flex4


 

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.

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>

0

</s:VGroup>

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

<s:RichText id="ricTxt"

1

width="100"

height="100"

paddingTop="2"

2

paddingLeft="2"

color="#990000"

lineBreak="toFit"/>

3

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

<s:stroke>

<s:SolidColorStroke color="blue"/>

4

</s:stroke>

</s:Rect>

</s:Group>

5

</s:HGroup>

</s:Panel>

</s:Application>

6

Output:

 

Running Application:

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

Download this code

7

Ads