Share on Google+Share on Google+

MX Effect with embedded font in Flex4

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

</mx:ApplicationControlBar>

<s:TextArea

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

fontFamily="fontFamily1"

x="106" y="94"

height="26" width="252"

color="#000000"

mouseDownEffect="{rotateClockWise}"

mouseUpEffect="{rotateAntiClockWise}"/>

<mx:TextArea

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

x="106" y="143"

height="26" width="252"

color="#000000"

mouseDownEffect="{rotateClockWise}"

mouseUpEffect="{rotateAntiClockWise}"/>

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

Advertisements

Ads

Posted on: July 2, 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.

Advertisement