Hello Flashcoders,
I am working on a project where I need to embed multiple typefaces in
my AS3 project. Here is what I got so far. I could happened to open
my flash 8 and create multiple font symbols and add a linkage and
check them to export them for actionscript. Then I put that file in
my AS3 project where I am developing using Flex Builder 2.
Then I just hacked an existing example with mashing flex2 examples on
adobe labs. My file name for flash 8 swf is "din.swf" and I went
ahead and added this line in the beginning of my project:
[Embed(source='din.swf', symbol='dinBold' )]
this worked perfectly! So the symbol 'dinBold' was its linkage name
when I was exporting it form flash 8. so far so good, but my problem
is how could I use this to import multiple typefaces?
When I go to extract multiple symbols from the same swf it simply
doesn't work. I have been following this from the flex docs at the
adobe lab so I couldn't understand why this is not working.
[Embed(source='din.swf', symbol='dinBold' )]// linkage name dinBold
[Embed(source='din.swf', symbol='dinLight' )] // linkage name dinLight
I can create a unique swf for each of the typeface but then this is
really cumbersome and I think there should be a way to import
multiple symbols from the same swf.
Thanks in advance.
ilteris
here is my source code just in case:
package {
import flash.display.Sprite;
import flash.text.*;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
[SWF(backgroundColor="#1C1A14", frameRate="61")]
[Embed(source='din.swf', symbol='dinBold' )]
public class Loadfont extends Sprite {
private var _timer:Timer;
private var tf:TextField;
public function Loadfont() {
tf = new TextField();
test();
listFonts();
_timer = new Timer(1);
_timer.addEventListener("timer", onTimer);
_timer.start( );
}
public function test():void {
tf.defaultTextFormat = new
TextFormat("DIN-BoldAlternate", 50, 255);
tf.embedFonts = true;
tf.antiAliasType = AntiAliasType.ADVANCED;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.border = false;
tf.text = "blah blah blah\nblah blah blah\nblah blah blah
";
tf.rotation += 2;
addChild(tf);
}
public function listFonts() {
var fontList:Array = Font.enumerateFonts(false);
for (var i:uint=0; i<fontList.length; i++) {
trace("font: "+fontList[i].fontName);
}
}
public function onTimer(event:TimerEvent):void {
tf.rotation += 2;
// trace(this.stage.stageHeight);
}
}
}
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com