Posts Tagged ‘scale’

DisplayObject Quirks and Tips


After having worked a great deal on the Rain SVG library, I’ve come to learn and re-learn some of the quirks and workarounds of DisplayObject, the fundamental UI class in ActionScript. For your benefit and mine, here they are. It’s only a short list of the many so if you’d like to add on, feel free to post a comment. Continue reading »

Size Text to Container


The new Text Layout Framework for Flash Player is a huge improvement over the historic TextField. Even so, it’s still not easy to have text auto-size to fit its container(s). In the demo app below I’ve implemented one solution that makes the text as large as possible without being cropped. Go head, type something in the box. Right-click the app to get to the source.

[kml_flashembed fversion="8.0.0" movie="/samples/sizetexttocontainer/Main.swf" targetclass="flashmovie" base="/samples/sizetexttocontainer/" publishmethod="dynamic" width="100%" height="200"]

Get Adobe Flash player


The basic methodology is very similar to the Guess the Number game where you whittle down the options until you get to the one you’re after. With a few smart guesses, this can be decently efficient (~20ms). If you can come up with a more efficient or elegant way to accomplish the same task, post a comment below!