Copy link to clipboard
Copied
Hi
I have load system fonts and I wanna change fonts in my dynamic textbox but it dosen't work,
I take files from http://www.emanueleferonato.com/2008/05/21/create-a-font-browser-with-flash-as3/ <<< you can download source file from here
you can view my files http://www.fltech.in/fontsissue/,
here the main issue is when you change font text goes unvisible
here my code
import fl.data.DataProvider;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.Font;
var fonts:Array = Font.enumerateFonts(true).sortOn("fontName");
var fonts_array:Array = new Array();
for (var i:int = 0; i < fonts.length; i++) {
fonts_array.push(new String(fonts.fontName));
}
var dp:DataProvider=new DataProvider(fonts_array)
font_list.dataProvider = dp
font_list.addEventListener(Event.CHANGE, change_font);
sampletext.addEventListener(Event.CHANGE,change_text);
function change_font(event:Event):void {
var font:TextFormat = new TextFormat();
font.font = new String(font_list.selectedItem.data);
displayer.setTextFormat(font);
}
function change_text(event:Event) {
displayer.text = sampletext.text;
}
Copy link to clipboard
Copied
apart from the fact that your app won`t work the way you intend,
since flash can`t simply access the users systemfonts and use them in a textfield:
you only have embedded a subset of chatracters in your Result field.
You have to embed every possible charcter if you want to gurantee it displayed.
Also: The change_font event somehow seems to clear the variable which holds the sample text.
Copy link to clipboard
Copied
you mean if i embed the font then will it work..?,
Copy link to clipboard
Copied
you mean if i embed the font then will it work..?,
If you want to publish over the web, your app will not work, simply because you can`t embed every possible font every of your users might have installed.
Copy link to clipboard
Copied
but same thing is working here, and I am using it's source code. please have a look.
http://www.emanueleferonato.com/2008/05/21/create-a-font-browser-with- flash-as3/
Copy link to clipboard
Copied
Hm, interesting, it works for me too.
Since the script is from 2008, avoid using TLF Text fields and publish to Flash 9.
Copy link to clipboard
Copied
I m already using dyamic text box with flash player 9. but nothing works for it.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now