View Full Version : change a dynamic text field font
sonic_2k_uk
01-29-2003, 08:46 PM
hi. Im creating a simple flash app rather like notepad for a school project and ive got just about everything apart from the font. how can i make it so that when you click a button it changes the font?
i thought it would be something like this:
on (release) {
_root.text2.font = "comic sans ms";
}
but it isnt!
cheers
Billy T
01-29-2003, 09:20 PM
I think that will just effect text that you add after you change the font
try using the textFormat object
cheers
sonic_2k_uk
01-29-2003, 09:56 PM
tried
on (release) {
myTextFormat = new TextFormat();
myTextFormat.font = "comic sans ms";
myTextField.setTextFormat(myTextFormat);
}
but cant get it to work!
Billy T
01-29-2003, 10:02 PM
Originally posted by sonic_2k_uk
"comic sans ms";
is that the exact name?
put this on the first frame
arr=TextField.getFontList()
for(i in arr){
trace(arr[i]);
}
and see what it says
obviously if you don't embed the font then the user will need to have it installed
sonic_2k_uk
01-29-2003, 10:18 PM
got this to work
on (release) {
myformat = new TextFormat();
myformat.font = "Comic Sans MS";
mytext.setTextFormat(myformat);
}
whats the .getfontlist about?
cheers for your help
Sonic
Billy T
01-29-2003, 11:27 PM
gives you a list of all the fonts on the users comp
cheers
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.