Embed fonts by location by using the [Embed] tag syntax
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Style>
.mystyle1 {
fontFamily:myFont;
fontSize: 32pt;
}
.mystyle2{
fontFamily:myBoldFont;
fontSize: 32pt;
fontWeight: bold;
}
</mx:Style>
<mx:Script>
[Embed(source='a.ttf',fontName='myFont', mimeType='application/x-font' )]
private var font1:Class;
[Embed(source='a.ttf',fontWeight='bold', fontName='myBoldFont',mimeType='application/x-font', flashType='true' )]
private var font2:Class;
</mx:Script>
<mx:Panel title="Embedded Fonts Using ActionScript">
<mx:VBox>
<mx:Label width="100%" height="75" styleName="mystyle1"
text="uses WebPro font." rotation="15" />
<mx:Label width="100%" height="75" styleName="mystyle2"
text="uses WebPro-Bold font." rotation="15" />
</mx:VBox>
</mx:Panel>
</mx:Application>
Related examples in the same category