Behaviors are small pieces of code that can be placed in frames or within objects themselves. When a behavior is selected, an interface will pop up for certain parameters of the behavior to be chosen or filled in. When placing actions within objects, behaviors have events associated with them that can be adjusted directly from the Behaviors panel. Flash comes with a certain number of built-in behaviors, and you can download more from select vendors or from Macromedia. You can also create your own behaviors, which is covered in Chapter 27, "Extending Flash."
You can open the Behaviors panel by selecting Window> Behaviors. You can see the Behaviors panel in Figure 8.15.
Figure 8.15. The Behaviors panel.
Follow these steps to place a behavior in a button:
Now test the movie by going to Control, Test Movie and then clicking the button. It should take you to something like Figure 8.17 if you are connected to the Internet.
Figure 8.17. Use behaviors to quickly add ActionScript to your files.
That was an easy and fast way to add some interactivity to the Flash file. Now we will begin to delve into the fundamental aspects of ActionScript itself including some of the built-in objects and good practices.