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

Moving On

In about 74 lines of code, you built a dynamic menu system that allows you to easily add and remove navigation links. With minimal work, you could make this code more portable by putting the functions into an external file and including the file using the #include compiler directive. Using this method allows you to easily copy and paste the external ActionScript file and reuse the menu in a different Flash project.

To make this modification, you need to cut both the navButton() and drawRectangle() functions from the Flash document and create a new ActionScript (.as) file using either Flash MX Professional 2004 or a text editor. Paste the ActionScript code you just cut from the menu.fla document into the .as file, and save the ActionScript file as menu.as in the same folder as the menu.fla file. Open the menu.fla file and add the following line of code to the very beginning of the Actions panel:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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