O'Reilly logo

The ActionScript 3.0 Quick Reference Guide by Rich Shupe, Darren Richardson, David Stiller, Jen deHaan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required