Dowload PDF in Full Site Email the Author

Generic External Scripts
I want to make my scripts as generic as possible so that I can use them again and again, even in other movies. For example, if we select the button.highlight Instance in the button.preferences Layer (hereafter referred to as the preferences button) we could place the following script:

on (rollOver) {
gotoAndStop("1");
}

On the services button we could cut and paste the same script and modify the destination:

on (rollOver) {
gotoAndStop("2");
}

And we could continue from there. Instead, what I do is keep a folder on the web server and on my development machines with the script examples above in separate external files. In this case, I’ve made a folder called xscripts and placed external script files within it. For example this script:

on (rollOver) {
gotoAndStop("1");
}

Is stored in a file called rollover1.as (the as is for ActionScript.) I’ve made a series of rolloverX.as files that reference frame labels 1, 2, 3, etc. That way, whenever I have to use the script I simply reference it within an Flash movie I’m developing.
To reference an external script, use the include statement, as in:

#include "xscripts/rollover1.as"

We would place this statement in preferences button Instance. Then, all we need to do is cut and paste this statement into the other buttons and change the number of the script being referenced accordingly.
In this case, I’ve placed the following statements in the following buttons.

#include "xscripts/rollover1.as" in the preferences button.
#include
"xscripts/rollover2.as" in the services button.
#include
"xscripts/rollover3.as" in the profile button.

For the time being, I’ve left the rest of the buttons without scripts. We’ll place scripts in each at a later time.
Of course, to reference external scripts, you need to have external files placed in a particular folder (or if you like, in the same folder as your swf files). To create the external files, I follow one of three methods.

  1. Create the script in the Actions Panel and select Export as File from the fly out menu.
  2. Create the script in a text editor such as Notepad.
  3. Create the script in a text editor such as EditPlus (http://www.editplus.com). EditPlus is a Windows program which has syntax highlighting for Flash as an optional download.

I’ve added the include statements to the appropriate buttons and created the scripts in the appropriate referenced folder for you. Make sure to place the folder into the same folder where you’re keeping your swf files. Load xscripts.zip and m0006.fla.
There are some additional scripts we haven’t talked about. We’ll get to them as we continue through this article.
Of course, we haven’t even created the rest of the submenu clips and placed them on the appropriate Timelines. Let’s continue by creating the submenu clips. I’ll detail how I create one and then we can load a file with all of them already built.


Introduction Adding Sound to the Arrow
How the Menu will Function Building the Menu Item Clips
A Look at the Menu Generic External Scripts
Planning and Mapping Navigation Building the Submenu Clips
Building the Assets Menu Assembly: Putting the Clips Together
Sound Building and Scripting the Fly-outs
Draggable Menu Menus within Menus
Expand/Collapse Arrow