Now that you added ActionScript in several different places in your FLA file, you should try using the Script navigator to find scripts that you have added to the document. Unfortunately you can't keep your ActionScript all in one place when you're using behaviors, so it is a good idea to familiarize yourself with these tools to help you find where scripts are placed when you need them in your FLA file. The Script navigator can be used to navigate through the scripts you have in a document. It contains a tree where you can navigate through all the different pieces of code in your FLA file. Frame and object actions are all represented in the Script navigator as part of the tree structure it uses to organize the code in.
You can also pin scripts in the Actions panel. If you select a piece of code in the Script navigator, you can either click a pin button to pin the script or double-click the code in the Script navigator. This means the code remains "open" in the Actions panel, like an open document with its own tab.
Then all you have to do is click the tab to access the piece of code for editing in the Actions panel. Script pins make it easy to navigate through and edit each piece of code by clicking on different tabs right below the Script pane. You'll find out how to use script pinning in the following exercise.
Using bookstore10.fla, expand or open the Actions panel by pressing F9.
The Actions panel opens with the Actions toolbox and Script navigator on the left, and the Script pane to the right. A bar separates the two areas, and it can be resized as necessary.
Move the bar between the Script pane and the Script navigator to resize each section of the Actions panel.
You can click and drag the bar between each area to resize the Script navigator section of the Actions panel. When you are editing code, you probably want to minimize the Script navigator and Actions toolbox section by clicking on the arrow button in the middle of the bar to close it completely.
With the Script navigator maximized, click actions: Frame 11 under the mcProductsMenu heading.
When you click each of these items, you can see the associated code appear in the Script pane. When you click an item in the Script navigator, the document's playhead moves to the frame that the selected script is on. The Script navigator helps you navigate throughout the code in a FLA file without too much effort. When you find code that you need to edit, you can pin these scripts, as seen in the following step.
Select actions: Frame 11 in the Script navigator under the mcProductsMenu heading and click the Pin active script button below the Script pane. Then try pinning a second script in the document.
After you click the Pin active script button, which looks like a thumbtack, the code stays in the Actions panel until you close the pinned script.
Click actions: Frame 11 in the Script navigator and then click the Pin active script button. You can also select an instance or frame containing a script on the Stage and then right-click (or Control-click on the Mac) the script tab in the Actions panel and choose Pin Script from the contextual menu. This procedure pins the script in the Actions panel, and you see a new tab added underneath the Script pane as a result.
You can also double-click the code in the Script navigator to pin the script in the Actions panel. To close a pinned script, select one of the actively pinned scripts either by its tab or the pinned script in the Script navigator. When it is selected, the pinned script thumbtack changes; when you click the button, the script is unpinned.
Click through the script tabs for the pieces of code that you have pinned.
Use the script tabs below the Script pane to navigate through the pinned scripts. Navigating through the scripts does not move the playhead in the FLA file. Pinned scripts make it much easier to find code than having to hunt through the Flash document to find all the different places you might have placed code. If you use behaviors to place code on different instances, you will probably notice how useful this tool is!
Note: If you have too many scripts pinned that the Actions panel is not large enough to hold all the tabs, a double-arrow button appears to the right of the panel. If you click this button, a menu appears that shows the additional pinned scripts.
You do not need to save any changes that you made in this exercise, so just close the document and choose not to save changes when you're finished.
In Lesson 9, you will learn more about the ActionScript language and why it works the way it does. The more you know about ActionScript, the more you can ultimately make your Flash 8 applications do.