5 tips for a better dynamic text management in Flash
I am starting the new year with a post about commons mistakes when using a dynamic text in Flash, and how to manage it
1) Give your text an instance name
Giving your text an instance name will make your dynamic text to be changed more easily than using the Var field.
For instance, if you instanced your text as my_text, you can simply change its content with _root.my_text.text = "Hello World", and you text will be independent from any variable
If you use the Var field, your text depends on the variable you will assign.
It’s not a big difference, but I prefer to change the text no matter any other variable has changed

2) Make it Multiline
Even if you don’t plan to have a multiline text, it’s better to have a Multiline text with a single line than a Single line text with multiple lines. To write on a new line, simply use the \n, for example _root.my_text.text = "Hello World\nLine 2".

3) Don’t make it selectable
This is a very common mistake… in almost all cases you don’t need selectable text. The problem is Flash sets a dynamic text to be selectable by default.
This is the result… I am showing you the issue on a game of a blog reader but it’s full of these errors in Flash games… mine too…
The game is Wobble Dodge and the error is the one marked in red.

There is no need to make the score selectable… isn’t it?

4) Think about antialiasing
Talking about antialiasing, there are two types of fonts: pixel fonts and non-pixel fonts. On pixel fonts you don’t have to use antialiasing, while on non-pixel fonts you must use it.
Look at the example for a better understanding

So choose wisely when to make a text with or without antialiasing

5) Embed the fonts
Ok, you found a really good-looking font and want to use it in your next project… very well… too bad you are the only one to have that font. You must embed the font, or at least the characters you plan to use or in most cases your font will lose antialiasing (that means looking bad) or in some players will be replaced by a default font (that means looking even worse)

In most cases embedding Uppercase, Lowercase, Numbers and Punctuation should be enough

Ok, that’s all. Let’s make our texts look better
How many times did you mess up fonts?
They can be easily customized to meet the unique requirements of your project.















(4 votes, average: 4.00 out of 5)









This post has 11 comments
wildwobby
Nice tips!
I’ll update my Wobble Dodge ASAP.
shiv
Hi emanuele!
Great tips..
Wackiedk
Cool tips, good idea by explaining the common mistakes with dynamic text. Maybe you could also cover up other common mistakes. :)
Jack Hopkins
I’ll have to update my games!
Thanks!
Ed
Wow, I never knew most of those things. Definitely the most helpful post in a long time. ^^
Also how do I get the ‘Character Embedding’ box up? And why is the pic on step 5 the same as on step 1?
Emanuele Feronato
Ed: there was an error in the images.
Check the post again and you will find the right image that will guide you through the character embedding
RJ
In my opinion, the most useful tip was the one about making the text selectable, I hate my texts being selectable, but I didn’t know how to avoid it. The 5th tip is also useful
Thanks, EF
Jensa
At Flash On The Beach, I attended a really good session on text and embedding. One of the best tips in the session was to embed two selections in the “Character embedding” dialogue: Basic Latin and Latin 1. If you embed these two, you’re safe for all European languages while embedding as few characters as possible (including scandinavian/german characters such as æ, ø, Ã¥, ö, ü and more).
The URL for this sessions notes are: http://www.flashmagazine.com/1457.htm and Dave Williamson was the speaker (a little down the page). Includes a surefire Font Embedding method for Flash.
J
Jamie
Hey Emanuele! Thank you so much for these tips! I am self taught in Flash so I am still learning the ropes. Never thought to embed the fonts, though. Built great looking percentage preloaders and, you guessed it, default fonts seemed to show up on all other computers than mine. I fixed it, so again MANY THANKS and your site is already bookmarked!
Text in Flash | Welcome Flash World
[...] Read more [...]
Text in Flash | Lemlinh.com
[...] Read more [...]