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

Flash Fonts

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".

Flash Fonts

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.

Flash Fonts

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

Flash Fonts

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

Flash Fonts

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

Flash Fonts

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)

Flash Fonts

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

Flash Fonts

Ok, that’s all. Let’s make our texts look better

How many times did you mess up fonts?

Get the most popular Phaser 3 book

Through 202 pages, 32 source code examples and an Android Studio project you will learn how to build cross platform HTML5 games and create a complete game along the way.

Get the book

215 GAME PROTOTYPES EXPLAINED WITH SOURCE CODE
// 1+2=3
// 100 rounds
// 10000000
// 2 Cars
// 2048
// A Blocky Christmas
// A Jumping Block
// A Life of Logic
// Angry Birds
// Angry Birds Space
// Artillery
// Astro-PANIC!
// Avoider
// Back to Square One
// Ball Game
// Ball vs Ball
// Ball: Revamped
// Balloon Invasion
// BallPusher
// Ballz
// Bar Balance
// Bejeweled
// Biggification
// Block it
// Blockage
// Bloons
// Boids
// Bombuzal
// Boom Dots
// Bouncing Ball
// Bouncing Ball 2
// Bouncy Light
// BoxHead
// Breakout
// Bricks
// Bubble Chaos
// Bubbles 2
// Card Game
// Castle Ramble
// Chronotron
// Circle Chain
// Circle Path
// Circle Race
// Circular endless runner
// Cirplosion
// CLOCKS - The Game
// Color Hit
// Color Jump
// ColorFill
// Columns
// Concentration
// Crossy Road
// Crush the Castle
// Cube Jump
// CubesOut
// Dash N Blast
// Dashy Panda
// Deflection
// Diamond Digger Saga
// Don't touch the spikes
// Dots
// Down The Mountain
// Drag and Match
// Draw Game
// Drop Wizard
// DROP'd
// Dudeski
// Dungeon Raid
// Educational Game
// Elasticity
// Endless Runner
// Erase Box
// Eskiv
// Farm Heroes Saga
// Filler
// Flappy Bird
// Fling
// Flipping Legend
// Floaty Light
// Fuse Ballz
// GearTaker
// Gem Sweeper
// Globe
// Goat Rider
// Gold Miner
// Grindstone
// GuessNext
// Helicopter
// Hero Emblems
// Hero Slide
// Hexagonal Tiles
// HookPod
// Hop Hop Hop Underwater
// Horizontal Endless Runner
// Hundreds
// Hungry Hero
// Hurry it's Christmas
// InkTd
// Iromeku
// Jet Set Willy
// Jigsaw Game
// Knife Hit
// Knightfall
// Legends of Runeterra
// Lep's World
// Line Rider
// Lumines
// Magick
// MagOrMin
// Mass Attack
// Math Game
// Maze
// Meeblings
// Memdot
// Metro Siberia Underground
// Mike Dangers
// Mikey Hooks
// Nano War
// Nodes
// o:anquan
// One Button Game
// One Tap RPG
// Ononmin
// Pacco
// Perfect Square!
// Perfectionism
// Phyballs
// Pixel Purge
// PixelField
// Planet Revenge
// Plants Vs Zombies
// Platform
// Platform game
// Plus+Plus
// Pocket Snap
// Poker
// Pool
// Pop the Lock
// Pop to Save
// Poux
// Pudi
// Pumpkin Story
// Puppet Bird
// Pyramids of Ra
// qomp
// Quick Switch
// Racing
// Radical
// Rebuild Chile
// Renju
// Rise Above
// Risky Road
// Roguelike
// Roly Poly
// Run Around
// Rush Hour
// SameGame
// SamePhysics
// Save the Totem
// Security
// Serious Scramblers
// Shrink it
// Sling
// Slingy
// Snowflakes
// Sokoban
// Space Checkers
// Space is Key
// Spellfall
// Spinny Gun
// Splitter
// Spring Ninja
// Sproing
// Stabilize!
// Stack
// Stairs
// Stick Hero
// String Avoider
// Stringy
// Sudoku
// Super Mario Bros
// Surfingers
// Survival Horror
// Talesworth Adventure
// Tetris
// The Impossible Line
// The Moops - Combos of Joy
// The Next Arrow
// Threes
// Tic Tac Toe
// Timberman
// Tiny Wings
// Tipsy Tower
// Toony
// Totem Destroyer
// Tower Defense
// Trick Shot
// Tunnelball
// Turn
// Turnellio
// TwinSpin
// vvvvvv
// Warp Shift
// Way of an Idea
// Whack a Creep
// Wheel of Fortune
// Where's my Water
// Wish Upon a Star
// Word Game
// Wordle
// Worms
// Yanga
// Yeah Bunny
// Zhed
// zNumbers