Kerning dynamic text-fields

Hey Fellow Kirupians!

Posting my first post here :}

What I’m doing is that I want to create textfields using flash and insert them into my HTML portfolio site.

The reason I’m doing this is to be able to use special fonts, kern the text properly and customize the anti-aliasing. I tried with CSS but I don’t have enough control using that (regarding kerning and anti-aliasing).

I have created a Flash file that can load specific .txt files into the textfield of the SWF (so that the text becomes formatted), using FlashVars.

I discovered that kerning in Flash doesn’t apply to dynamic textfields unless you set it using actionscript. So I’ve tried to use the following code on my textfield:


var myFormat:TextFormat = new TextFormat();
myFormat.letterSpacing = 3;

var myText_txt:TextField = new TextField();

myText_txt.defaultTextFormat = myFormat;
myText_txt.embedFonts = true;

The problem is that when I use this code on the dynamic textfield it doesn’t load the text as it should.:h:

I have attached a .zip’ed file with the an .html, the .fla and the 2 .txt files.

I don’t know much about Actionsscript, so I would really appreciate if somebody who’s good at Actionscript could look into it I have searched the forums without any luck. I saved the .fla is in Flash 8 format b.t.w. but I work in Flash CS3 if that has anything to say…

Thanks in advance

Anders