Hi,
I am trying to get the following example to work in Flash Builder 4:
http://developer.yahoo.com/flash/articles/runtime-fonts-as3.html
The Actionscript project compiles but all I get on screen is a tiny rotated square with no text in it.
Does anyone know why this might be happening? My code is identical to the example above - I have compiled the first class into _Arial.swf.
Many thanks,
EDIT:
Ive also tried this...
package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.text.*;
public class _Arial extends Sprite {
[Embed(source='C:/WINDOWS/Fonts/ARIAL.TTF', fontName='_Arial', fontFamily='myFont', mimeType='application/x-font')]
public static var _Arial:Class;
public function _Arial():void {
drawText();
}
public function drawText():void {
var tf:TextField = new TextField();
tf.defaultTextFormat = new TextFormat("_Arial",60,0);
tf.embedFonts = true;
tf.antiAliasType = AntiAliasType.ADVANCED;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.border = true;
tf.text = "Scott was here\nScott was here too\nblah scott...:;*&^% ";
tf.rotation = 15;
addChild(tf);
trace(Font.enumerateFonts());
}
}
}
var fontList:Array = Font.enumerateFonts(false);
for (var i:uint=0; i<fontList.length; i++) {
trace("font: "+fontList[i].fontName);
}
The trace displays: font: _Arial