• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 2. Writing and Editing ActionScript 2.0 > Organizing ActionScript code

Organizing ActionScript code

You may attach scripts to keyframes and to object instances (movie clips, buttons, and other symbols). However, if your ActionScript code is scattered over many keyframes and object instances, debugging your application will be much more difficult. It will also be difficult to share your code between different Flash applications. Therefore, it’s important to follow best practices for coding when you create ActionScript in Flash.

Rather than attaching your scripts to elements like keyframes, movie clips, and buttons, you should respond to events by calling functions that reside in a central location. One method is to attach embedded ActionScript to the first or second frame of a timeline whenever possible so you don’t have to search through the FLA file to find all your code. A common practice is to create a layer called actions and place your ActionScript code there.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint