The following example shows how you can use an embedded font with the Flash ActionScript 3.0 TextInput control by setting the embedFonts and textFormat styles.
Full code after the jump.
// ActionScript 3.0 /* Requires: * - TextInput component in Flash library * - Embedded font with class name "MyEmbeddedFont" in Flash library */ import fl.controls.TextInput; var embeddedFont:Font = new MyEmbeddedFont(); var textFmt:TextFormat = new TextFormat(); textFmt.color = 0xFF0000; textFmt.font = embeddedFont.fontName; textFmt.size = 18; var textInput:TextInput = new TextInput(); textInput.text = new Date().toString(); textInput.setStyle("embedFonts", true); textInput.setStyle("textFormat", textFmt); textInput.width = 300; textInput.move(10, 10); addChild(textInput);

Figure 1. Font Symbol Properties dialog box.
6 Responses to Using an embedded font with the TextInput control in Flash using ActionScript 3.0
Leave a Reply Cancel reply
Recent Posts
- Getting started with the TLFTextField class in ActionScript 3.0 and Flash CS5
- Adding tick marks to a Slider control in Flash using ActionScript 3.0
- Creating a vertical Slider control in Flash using ActionScript 3.0
- Creating a custom context menu item in Flash using ActionScript 3.0
- Rotating a Sprite object around its x-axis in Flash using ActionScript 3.0 and Flash Player 10
- Detecting when the user changes the color in a ColorPicker control in Flash using ActionScript 3.0
- Getting the currently selected color as a hexadecimal value on a ColorPicker control in Flash using ActionScript 3.0
- Toggling the text field on the ColorPicker control in Flash using ActionScript 3.0
- Creating a vertical Slider control in Flash using ActionScript 3.0
- Setting the number of columns on a ColorPicker control in Flash using ActionScript 3.0
Categories
- Bitmap (1)
- Components (72)
- Button (19)
- CheckBox (2)
- ColorPicker (6)
- ComboBox (1)
- DataGrid (8)
- FLVPlayback (7)
- Label (9)
- ProgressBar (2)
- Slider (3)
- TextArea (1)
- TextInput (7)
- UILoader (7)
- ContextMenu (1)
- Embed (4)
- ExternalInterface (2)
- Flex (7)
- Font (2)
- General (5)
- Graphics (2)
- JSFL (14)
- Loader (3)
- LoadVars (3)
- Microphone (1)
- migration (12)
- MovieClip (1)
- MovieClipLoader (1)
- Sound (2)
- TextField (1)
- TLFTextField (1)
- TransitionManager (1)
- Tween (1)
- Uncategorized (1)
- URLLoader (4)
- URLVariables (1)
- Video (1)
- XML (2)
Advertising
" RT @OReillyMedia: #Ebook Deal/Day: Learning JavaScript Design Patterns -
$11.99
(Save 50%)
http://t.co/ilcmSDv6 " — pdehaan


Excellent, I was attempting to set embedFonts and textFormat through the TextInput.textField property for the longest time…
Hi. I’ve read this post as well as your article on http://www.adobe.com/devnet/flash/quickstart/embedding_fonts/ and I found that using the described instructions I can’t get the text fields to display unicode characters – only Latin1 characters can be embedded.
Do you know of a way to work around that limitation, as I really need to be able to embed fonts for unicode text.
Thanks.
Unicode characters in Flash textInput? Does anyone know how include these?
Thanks.
Gracias por compartir esta información. Ha sido muy valiosa para mi.
He solucionado un gran problema en una aplicación de Facebook desarrollada con AS3 y Flash CS5.
Upps :(
Ahora no me funciona la aplicación en Facebook, en local si.
¿Qué puede ser?
hello =D
well even this post is some years old , it really helped me =D thanks !, this was freaking me out !!
this solution solves the problem of spanish/latin characters like ñ or Ñ
I saw a solution like
textField.embedFonts = true ;
textField.textFormat= someTextFormat;
but there was not for TextInput or TextArea (only text field)
textField.setStyle("embedFonts", true);
textInput.setStyle("textFormat", textFmt);
so this helped me so much xD