Normal Mode

I l @ ve RuBoard

The Actions panel has two different modes. The default mode is Normal mode. In this mode, you cannot directly type scripts character for character. Instead, you must choose from the menu of keywords on the left side of the screen.

This is similar to how scripting in Flash 4 worked. It also makes it nearly impossible to make simple mistakes.

Tour of the Actions Panel in Normal Mode

Figure 2.1 shows the Actions panel in Normal mode. It is a complex window with many items to review.

Figure 2.1. The Actions panel can be used in Normal mode (shown here) or Expert mode.


The top of the panel shows a pop-up menu that shows exactly which script you are currently editing. In Figure 2.1, it reads Actions for Frame 1 of Layer Name Layer 1. This is just a fancy way of saying that it is the script on frame 1, layer 1.

On the left side of the panel is a list of ActionScript commands, sorted into categories. Click a category to expand it and see the subcategories or commands inside.

On the right side of the panel is a large blank space where options appear as you enter various commands and functions. Figure 2.2 shows the Actions panel after you choose to insert the command goto . Notice the Movie Control category has been expanded on the left. The goto command was double-clicked to insert it into the script.

Figure 2.2. The Actions panel in Normal mode as it looks after a goto command has been inserted.


At the top-right side of the panel is a short definition of the command goto . Below that is a custom set of options that apply directly to the goto command.

It looks like a small form with fields for Scene, Type, and Frame. This is the parameters area for the selected command. It changes depending on what type of ActionScript command is selected.

The first option for the goto command is whether it is a Go to and Play or a Go to and Stop command. In this case, a Go to and Play command is selected. Both commands are similar, except that the first stops the movie at the destination frame, and the second takes it to the destination frame and continues moving forward to the next frame. We'll look at these two commands in depth in Hour 5, "Controlling the Flow of the Movie."

This command needs some additional information to make it work. Namely, it needs to know what frame you want to jump to. The Scene field indicates which scene the destination frame is in. In this case, it is the current scene. The next field is a pop-up menu that lets you determine how you want to define the destination frame. You could define it by Frame Number, Frame Label, or Expression. We'll look at the other two options later, but for now Frame Number simply means that you will indicate the exact number of the frame, in this case 1.

Under all this are two buttons that have a plus (+) symbol and minus ( “) symbol in them. These allow you to quickly insert and delete commands in your script. However, they are rarely used alternate methods for doing this. You can delete commands by just using the Delete or Backspace key. You can insert commands by using the category list on the right side of the panel.

Next to the + and “ buttons are other buttons used for various things. You can search or find and replace text in the script. You can add debugging breakpoints. You can switch between Normal and Expert modes. You can also choose to see line numbers listed next to each line of the script. The little up and down arrows to the far right allow you to select the next or previous lines of code.

At the bottom-right side of the Actions panel is your script. In Figure 2.2, you can see the one-line script gotoAndPlay(1); . I placed this script there before taking the screenshot. That line is also highlighted by a dark shade of blue. This means that this line is selected.

At the bottom of the Actions window, you can see Line 1: gotoAndPlay(1); . This information area tells you what line number you are at and repeats the line for you.


The categories on the left side of the Actions panel break up all the ActionScript keywords into organized groups to make them easier for you to find. You are probably curious about what each category contains. We'll go into detail about specific keywords and symbols in later hours. For now, here is a summary:

  • Actions In this category, you'll see the simplest ActionScript commands and more. This category provides commands to test conditions, loop, create reusable functions, duplicate and create movie clips, and load data from a server. The keywords here form the meat of ActionScript. They are divided into the subcategories of Movie Control, Browser/Network, Movie Clip Control, Variables, Conditions/Loops, Printing, User-Defined Functions, and Miscellaneous Actions.

  • Operators These are keywords and symbols used in mathematical and comparative operations ”for instance, the + symbol, which performs addition, or the == symbol, which compares two items. They are divided into the subcategories of Arithmetic Operators, Comparison Operators, Logical Operators, Bitwise Operators, Assignment Operators, and Miscellaneous Operators.

  • Functions ActionScript functions allow you to change data in some way or return some information, such as the version of Flash. For instance, you can convert the characters "123" into the number 123 with a function. The term functions can also be used to describe reusable bits of code that you create. In addition to some basic functions, there are two subcategories of Mathematical Functions and Conversion Functions.

  • Constants Constants refer to special keywords that represent specific values such as true , false , null , and the newline character.

  • Properties Properties are keywords that give you access to information about elements in Flash, such as movie clips. For instance, the _x property returns the horizontal position of a movie clip on the screen.

  • Objects This category is the most diverse and most difficult to explain at this stage of the game. This is a catch-all for different concepts in ActionScript. All object keywords are divided into four subcategories: Core, Movie, Client/Server, and Authoring. One subcategory in Movie is Movie Clips. The keywords here relate to the manipulation of movie clips. Another subcategory is Math, which contains functions such as square root and cosine. You'll learn how to use the diverse set of commands and functions in the Objects category throughout the day.

  • Depreciated This category contains keywords that are obsolete but still work in Flash MX. Avoid these keywords at all costs because they may not be supported in future versions of Flash.

  • Flash UI Components This category contains keywords that specifically apply to special components , such as radio buttons and scrollbars.

  • Index The Index category is an alphabetical list of all keywords in ActionScript. Every keyword is listed both under its category and in this index.

Sometimes the categorizations in the Actions panel help you find keywords. At other times, they make it harder. For instance, you might think that _x , the horizontal position of a movie clip, might be found under Objects, Movie, MovieClip, Properties. But it is just under the Properties category at the main level. You might think that sqrt would be under Functions, but it is under Objects, Core, Math, Methods.

I l @ ve RuBoard

Sams Teach Yourself Flash MX ActionScript in 24 Hours
Sams Teach Yourself Flash MX ActionScript in 24 Hours
ISBN: 0672323850
EAN: 2147483647
Year: 2002
Pages: 272 © 2008-2017.
If you may any questions please contact us: