Random Etc. Notes to self. Work, play, and the rest.

Posts Tagged ‘text’

Simple Text Outlines in Flash

(This post is part of the series I threatened to write about actionscript 3.)

For the mySociety travel time maps I wanted to have user-defined labels that looked pretty much like the map styles in the OpenStreetMap base maps we were using, like this one:

London SW1P 4DR, from OpenStreetMap.org (licensed CC-BY-SA)

It turns out Flash doesn't have a way to draw the outlines of text easily, nor does it have a stroke filter like Photoshop. I tried a few different solutions that didn't work out, including a combinations of ConvolutionFilters (too hard to get right), GlowFilters (too blurry) and stacks of offset BevelFilters (nasty looking edges). Since the only thing in Flash that has the same quality antialiasing as the text does is, well, more text, that's what I ended up using. It looks like this:

Flash Text Outlines

I've included a sample SWF and pulled out the relevant AS3 code (for Flex Builder) in the full post, below.

(more...)