As you work in the Actions panel, Flash can detect the action you are entering and display a code hint. There are two types of code hints: a tooltip that contains the complete syntax for that action, and a pop-up menu that lists possible ActionScript elements. * To check the syntax of a script you're writing, click the AutoFormat icon ( ) (which will also format the script according to conventions so that it is easier for others to read) or click the Check Syntax icon ( ). Syntax errors are listed in the Compiler Errors panel. Navigating the Actions Toolbox The Actions toolbox gives you quick access to the core elements of ActionScript. It groups them by category. To add an element to your script, double-click it in the toolbox. [View full size image] There are several categories listed in the Actions toolbox. The Top Level category lists many common classes; if you select a class, you can access its methods and properties. Browse the Top Level and Language Elements categories to get a feel for what's included. If you know you need a particular set of code, but aren't sure how to format it, you can find it listed alphabetically in the Index category. For example, you can find an If statement by clicking Language Elements > Statements, Keywords & Directives > Statement > If; or simply Index > If. You don't need to use the toolbox to add code to your script, but it can help you ensure that you're using the code correctly. Working with Conditional Statements A conditional statement requires the script to determine whether something is true or false, and then to act based on that determination. You can use conditional statements for many purposes. In this lesson, you'll use one to determine whether the movie has finished loading. You could also use a conditional statement to evaluate input from a user (such as a password, survey answer, or button click) and to act on that input. About Conditional Statements The most common type of conditional statement is the if statement. The if statement checks a value or expression in its parentheses. If the value is true, the lines of code in curly brackets are carried out; otherwise, they are ignored. You can add an else statement to provide alternative instructions if the condition is not true. Add methods within the curly brackets after the if and else statements to give the script instructions. For example, the following script checks for a proper password. If the password is wrong, the script goes to a frame labeled Rejection; if the password is correct, it goes to a frame labeled Acceptance. The script uses an if statement that determines whether the password is equal to null; a gotoAndStop() method that is in effect if the if statement is true; an else statement that determines whether the password is equal to Tom; and a gotoAndPlay() method that is in effect if the else statement is true. if(password == null) { gotoAndStop("Rejection"); } else if (password = "Tom") { gotoAndPlay ("Acceptance"); } Adding an If Statement Start by adding an if statement to frame 2 on the Actions layer. You're adding the if statement to frame 2 so that the movie will loop back to frame 1 if the full movie hasn't loaded yet.