Share on Google+Share on Google+

Embedded font using Actionscript in Flex4

Advertisement
In this example you can see how we can use a embedded font using actionscript.

Embedded font using Actionscript in Flex4:

In this example you can see how we can use a embedded font using actionscript.

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

<!-- Embedded font using Action Script -->

<fx:Style>

.style1 {

fontFamily:myriadFont;

fontSize: 20pt;

}

.style2 {

fontFamily:boldFont;

fontSize: 18pt;

fontWeight: bold;

}

</fx:Style>

<fx:Script>

[Embed(source='MyriadWebPro.ttf',

fontName='myriadFont',

mimeType='application/x-font',

embedAsCFF='true'

)]

private var font1:Class;

[Embed(source='MyriadWebPro-Bold.ttf',

fontName='boldFont',

mimeType='application/x-font',

embedAsCFF='true'

)]

private var font2:Class;

</fx:Script>

<s:Panel title="Embedded Font Using Action Script Example"

width="348" height="145">

<s:VGroup x="12" y="24" width="324" height="48">

<s:Button label="Submit" styleName="style1"/>

<s:Label text="This is a Embedded font using ActionScript."

styleName="style2"/>

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

Advertisements

Posted on: June 24, 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.