In the earlier section "Linked Classes for Movie Clip Symbols," we learned how to link a class to a Movie Clip symbol. Now let's consider how to give many different Movie Clip symbols the same programmatic behavior by linking those symbols to a single superclass.
As an example, we'll create a simple login form with two different graphical interface styles. Such a form might be required in an application that offers its users a choice of interface designs, or skins. Our forms will look different, but their behavior will be the same.
We'll start by creating a .fla file, LoginApp.fla, in the Flash authoring tool.
In LoginApp.fla, we'll create two
symbols, one for each graphical style of the login form. We'll name
the first symbol LoginForm_Style1, and the second symbol
LoginForm_Style2. In each login form symbol, we'll add two manually
created input text fields (named
password) and a submit button (named
submitBtn). The submit button is,
itself, a hand-drawn instance of a Movie Clip symbol. Figure 29-11 shows the two login form
Figure 29-11. The login form symbols
Next, we'll create a LoginForm class that controls the behavior of the login form symbols. The LoginForm class responds to submit button clicks and transmits login information to a server. In this example, we'll set the compiler option "Automatically declare ...