[thelist] Actionscript - Using TextFormat.font

Alan McCoy a.r.mccoy at larc.nasa.gov
Wed Dec 18 16:16:01 CST 2002


I'm trying to pull in font names that are stored in user's database
record. The value for the font name is showing up correctly when I use
the variable in a dynamic text box, but I can't get the same variable's
value to work in the follwing code:

myTextFormat = new TextFormat();
myTextFormat.font = _root.fontstyle;
myTextFormat.size = 16;
myTextFormat.color = 0xFFFFFF;
tbartext.setTextFormat(myTextFormat);

"_root.fontstyle" is the variable that contains the font name value from
the database (like "Arial" or "Verdana"). The code works fine if I put
the font name directly into the code like:

myTextFormat.font = "Arial";

I think the key is getting the variable's value into the script with
quotes around it.

Anyone have a solution?

Alan




More information about the thelist mailing list