flex加载字体方式2:该加载方式使用css加载字体,只支持系统自带的字体,不支持嵌入式字体。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
<mx:Style>
.myStyle1{
font-family:宋体;
font-size:20px;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.controls.Image;
private function init():void{
var bmp:BitmapData =new BitmapData(aa.width,aa.height);
bmp.draw(aa);
var bt:Bitmap = new Bitmap(bmp);
var img:Image = new Image();
img.source=bt;
img.x=200;
img.y=200;
img.rotation=120;
addChild(img);
}
]]>
</mx:Script>
<mx:Label id="aa" x="143" styleName="myStyle1" y="139" text="你好" creationComplete="init()"/>
</mx:Application>