Talking about 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?
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.