MX Effect with embedded font in Flex4


 

MX Effect with embedded font in Flex4

We can use the embedded font when we are working with Fade and Rotate effect.

We can use the embedded font when we are working with Fade and Rotate effect.

MX Effect with embedded font in Flex4:

We can use the embedded font when we are working with Fade and Rotate effect. Because the Fade and Rotate effect support the Flash Text Engine(FTE) or an embedded font. In this example you can see how we can use an embedded font with effect. In the following example we rotate a TextArea which has an embedded text font. When we rotate the first TextArea then an embedded text font will also rotate. When we rotate the second TextArea then the simple font will not rotate and it will be invisible.

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:Style>

@namespace s "library://ns.adobe.com/flex/spark";

@namespace mx "library://ns.adobe.com/flex/mx";

@font-face {

src:url("MyriadWebPro.ttf");

fontFamily: fontFamily1;

embedAsCFF: true;

}

</fx:Style>

<fx:Declarations>

<mx:Rotate angleFrom="0"

angleTo="180"

id="rotateClockWise"

duration="500"/>

<mx:Rotate angleFrom="180"

angleTo="0"

id="rotateAntiClockWise"

duration="500"/>

</fx:Declarations>

<s:Panel title="Using embedded font with MX effects"

chromeColor="#000000" color="#CCCCCC" width="450" height="321">

<mx:ApplicationControlBar

color="#000000" width="448" horizontalAlign="center">

<s:Label text="Click on TextArea and show the effect" fontFamily="Verdana"/>

0

</mx:ApplicationControlBar>

<s:TextArea

text="This is a Embedded font . This text will rotate."

1

fontFamily="fontFamily1"

x="106" y="94"

height="26" width="252"

2

color="#000000"

mouseDownEffect="{rotateClockWise}"

mouseUpEffect="{rotateAntiClockWise}"/>

3

<mx:TextArea

text="This is a Simple font . This text will not rotate."

x="106" y="143"

4

height="26" width="252"

color="#000000"

mouseDownEffect="{rotateClockWise}"

5

mouseUpEffect="{rotateAntiClockWise}"/>

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

Ads