The basic class
Added 26 Jul 2008
Writing a CSS stylesheet is actually very simple. Flash provides us with a TextFormat object with which we can format text. The properties supported by the TextFormat object more or less correspond to many basic CSS properties. Applying CSS styles to a Flash TextField then entails simply that we map CSS properties to their corresponding TextFormat properties and then apply those TextFormat properties to a TextField.
To accomplish this, we will write a class which performs a number of tasks: (1) load a CSS stylesheet; (2) parse that stylesheet, convert the styles into objects, and assign the CSS properties and their values to those objects; (3) make those properties available for use by Flash objects such as TextFields. Throughout we will stick to Actionscript 1.0 code, but it is a trivial matter to accomplish the same thing with Actionscript 2.0.