Embedded font using Actionscript in Flex4


 

Embedded font using Actionscript in Flex4

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

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'

)]

0

private var font2:Class;

</fx:Script>

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

1

width="348" height="145">

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

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

2

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

styleName="style2"/>

</s:VGroup>

3

</s:Panel>

</s:Application>

Output:

4

Running Application:

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

Download this code

5

Ads