PDA

View Full Version : fontFamily for TextField



bortiquai
March 14th, 2009, 08:22 PM
I am using AS3 to dynamically create TextFields.

It is working fine, except I can't figure out how to apply a font. It is always the same.

i tried:

txtField.fontFamily = 'Arial';

but got the error "Property fontFamily cannot be applied to flash.text.TextField.

So how do i do this?
thanks

Elementss
March 15th, 2009, 03:39 AM
im having the same question. . . :-)
but i think you should create a fontfamily first then use it. . . i gues. . .

Elementss
March 15th, 2009, 03:50 AM
hey. . . me again. . :-)
follow this link:

http://www.kirupa.com/forum/showthread.php?t=321455&highlight=textfield+font

it should solve you your problems. . .
or just type "textfield font" in the 'search this forum' option. . :-)
its the best helper. . .
you get a million examples and other peoples questions about it

Joony5
March 15th, 2009, 10:25 AM
What you're looking for is to set the font property of a TextFormat, and then to apply the TextFormat to the TextField using the defaultTextFormat property.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextFormat.html

CSS is another option.

Bookmark this, it'll tell you everything you need to know:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/