Articles Archive
Articles Search
Director Wiki

Psychotically Fast Anti-aliased Text Scroller (and a free kitten!)

November 15, 2001
by Scott Southworth

I know that the rage of the day is now 3D; I really do. But I've decided to write an article on text. Yes, text. Boy, I bet that just sent shivers of excitement rippling through the entire development community. But wait! Today, we are going to explore text from the perspective of Imaging Lingo. Bitmap text. The kind of text you don't take home to meet your parents.

So, mid-yawn, why? Well, if you've ever worked with "living text" in Director before, you've no doubt noticed that it's not the fastest sprite on the block. In fact, text sprites in Director chug so slowly and cough so loudly that few developers would dare base an animation on them.

Luckily, there is a way around the clumsy text sprite. Convert it into a bitmap. Bitmaps are Director's cup of tea. But, alas, bitmaps carry the burden of large and dubious file sizes. Right? Wrong! As of Director 8, it's possible to capture the image property of any text member. In effect, we can package our text as text (tiny file size) and then transform our text into bitmaps on the fly (much faster). So, let's do it!

First, though, it's important to understand what the image of a text member really looks like.

Try this out: Make a bitmap member named "img" and a text member named "sample_text". Next, execute the following line in your message window.

member("img").image = member("sample_text").image.duplicate()

Open your Paint window and examine the "img" member. You probably don't see a pretty picture of your text. The reason? The image of any text member is a 32-bit graphic in which the text itself is stored almost fully in the alpha channel (the last 8-bits). The visible 24-bit part of the text is simply built with solid blocks of color. Thus, the important information is an 8-bit transparency selection. If we apply this alpha channel to any solid block of color, we'll see our text once more!

As a double bonus, since the alpha channel is only 8 bits of data per pixel, we can sling less image data about than if we were copying and pasting 32-bit color. This means we use less RAM and get faster text-to-image action.

The catch? Rendering a text member into a bitmap is SLOW. This means that we have to be careful...

There are several ways of dealing with this issue, though. If your end product is CD-based, simply batch-convert your text into bitmaps. Who cares about file size when you have hundreds of spare megabytes with which to play? For web delivery, I usually focus on distributed pre-rendering to keep things going smoothly. Basically, I render images ahead of time, just-in-time, preferably during idle periods. More simply, you could pre-render all of your text during your movie's initialization phase; it works, but it's not very elegant.

I wrote a couple of scrolling text behaviors to demonstrate these techniques. To really get a feel for just how much more responsive the imaging lingo method really is, try reproducing the demo movie using Director's standard scrolling text sprite. It's SO slow.

Download the Director 8 source code in Mac or Windows format.

The sample movie contains excerpts from Skirnir's Journey, a little bit of Norse mythology in action. I'm absolutely obsessed with all things Scandinavian, so please, bear with me.

Until next time (when I bring the free kitten),

Scott Southworth.

 Scott Southworth hails from the very warm and humid state of Tennessee. Raised in the wild by a family of earthworms, co-workers often comment most fiercely on the state of his desk, currently a computer in its 'natural' habitat. While not fighting various hordes of intergalactic invaders, Scott likes to sleep and sometimes eat. He is currently employed by Healthstream, Inc., the leading provider of e-learning solutions for the healthcare industry and also runs

Copyright 1997-2017, Director Online. Article content copyright by respective authors.