Chapter 6. Creating a Document Class
Flash CS4 Professional lets you associate a document class with your FLA file. The document class is an optional class definition that controls the main timeline, and is constructed when the main timeline initializes. If you choose not to provide your own document class, then Flash generates one for you in documents configured for ActionScript 3.0. The choice is yours, which means you can migrate to this new feature at your own pace. As a note of encouragement, you won’t find anything unusual in FLA files with automatically generated document classes. The main timeline operates and feels the same as it used to. You can still put frame scripts where you like; it’s just that the main timeline has taken on a more formalized structure behind the scenes.
In FLA files with a custom document class, the main timeline can be
programmed to offer additional functionality in a way that feels built-in.
You could, for example, create a document class with a pauseFrame()
method, something that pauses the
timeline for a given number of seconds, then lets it continue. (This
suggestion is demonstrated later in this chapter.) Thanks to the document
class, using the new pauseFrame()
method
becomes as hassle-free as using stop()
or
gotoAndPlay()
: just type it into whatever frame script meets your needs. This addition to the Flash workflow is useful in team environments where designer and developer disciplines may not overlap, because it allows for complete separation ...
Get The ActionScript 3.0 Quick Reference Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.