Friday, February 11, 2011

SHARE - How to embed font from swf file using Font Loader

You can download Fontloader [here](http://etcs.ru/pre/FontLoaderDemo/srcview/FontLoaderDemo.zip)

You can see demo [here](http://etcs.ru/pre/FontLoaderDemo/)

FontLoader can embed all your font automatically.

It better then my last post about embed font on flash.


on your action script

package{

import flash.net.URLLoader;
import flash.net.URLRequest;

import ru.etcs.utils.FontLoader;

public class Main extends Sprite {

private const _loader:FontLoader = new FontLoader();

public function Main(){

this._loader.addEventListener(Event.COMPLETE, this.handler_complete);
this._loader.load(new URLRequest("Arial.swf"), true);

}

private function handler_complete(event:Event):void {

if(this._loader.fonts.length>0){
trace('FONTS');
var fonts:Array = this._loader.fonts;
for each (var font:Font in fonts) {
trace('--------------------------------------');
trace(font);
trace(font.fontName);
trace('--------------------------------------');
}
}
}

}

}

No comments:

Post a Comment