PDA

View Full Version : Use Library Resources from Class



absameen
February 28th, 2009, 05:47 PM
I have a font in my library and I want to access it from a class.

myFont:Font = new FontName(); doesn't seem to be working.

The linkage is setup. How can I get this to work?

cbeech
February 28th, 2009, 06:31 PM
you must create a TextFormat instance, specifying the font, and apply it to the TextField, as in:

var fmt:TextFormat = new TextFormat('myFont'); //font linkage as a string
myTextField.setTextFormat(fmt);

absameen
February 28th, 2009, 07:01 PM
Thanks again. I was doing "myFormat.font = myFont.fontName" which wasn't working.