Although you can write ActionScript 3.0 code directly onto the timeline, it isn't a recommended practice. Instead you really should apply a more object-oriented approach and develop your own custom classes. This is of particular importance on large-scale projects.
Most ActionScript developers should already be comfortable creating classes but we will cover the steps here for the avoidance of doubt. Specifically, this recipe will have you create a basic document class that can be applied to the example app you started in the previous chapter.
We will be working from the latest version of bubbles.fla
from Chapter 2. Alternatively, you can open chapter3\recipe1\bubbles.fla
from the book's accompanying code bundle.