PHOTOGRAPHERSONLINEPROOFING.COM

proofreading marks stet - www.photographersonlineproofing.com

Menu


You'll use the Actions toolbox to add an if statement that determines whether the number of bytes loaded equals the total number of


bytes in the movie. Then you'll add an else statement, which will be active if the if statement is false. 1. Select frame 2 in the Actions layer. [View full size image] 2. Press F6 to insert a keyframe. 3. Choose Window > Actions to open the Actions panel. To open the Actions panel quickly, press F9 (Windows) or Option+F9 (Mac OS). 4. In the Actions toolbox, click Language Elements > Statements, Keywords & Directives > Statement. 5. Double-click the if statement to add it to the Script pane in the Actions panel. The word if appears with open parentheses following it. [View full size image] 6. In the open parentheses of the if statement, type the following so that ActionScript will determine whether the movie has completely loaded: this.bytesLoaded==this.bytesTotal Note The == operator compares the values surrounding it to determine whether it's true or false. If the condition is true, the script performs an action; you'll add an else statement to provide an action if the condition is false. 7. After the closing bracket, add an else statement by typing else{} 8. Click the Auto Format ( ) button to format the script. Auto Format shifts the brackets, and it verifies that there are no syntax errors. Note If errors are reported, compare your script with the script in the following image. You can also open the 07End.fla file, select frame 2 in the Actions layer, and view the ActionScript in the Actions panel. [View full size image] Adding Methods to the Statement Remember that methods create action. So far, you've created the if and else statements to determine whether the movie has loaded. Now you need to add the actions the script will perform based on those conditions. If the movie has fully loaded, you simply want it to play; if it hasn't, you want the script to return to frame 1. 1. Inside the first set of brackets, following this.bytesTotal, type play(); 2. Inside the set of brackets following else, type gotoAndPlay(1); 3. Click the Auto Format ( ) button to format the script. It shifts the script text to match that in the image below, and it verifies the syntax, as well. [View full size image] The conditional statement determines how long to play the preloader; it loops to the first frame until the movie has loaded. You don't need a preloader when you're streaming a movie and it does not rely on ActionScript. Then the movie plays as it streams.   Adding a Stop Action