Share this Page URL

Lesson 19. Advanced Navigation > Using a Repeat Structure - Pg. 421

Advanced Navigation 421 5. One way or another, the exitFrame handler is going to send the movie back to Menu.dir. The only thing in question is where in Menu.dir the playback begins. The if statement checks whether the movie is running in 8-bit mode. If it is, then the following statement is executed, and the movie branches to Menu.dir; there is no need to specify a frame because the playback begins at frame 1 by default. Thus, if the computer is in 8-bit mode, a branch to a transition is avoided. If the computer is not in 8-bit mode, the statement following the else statement is executed, and the movie branches to the transition. Save your work and then open Menu.dir again. Run the movie and click the Order button. From the Order movie, click the Back button. The movie should branch to the Order movie and back without any palette flash, even at an 8- bit color depth. There is another location in the movie where an if statement would be useful to test a condition. Try running the movie and clicking the Restaurants button. While the mouse is over the Res- taurants button the static.aif sound plays. When you click the button and the movie branches to the Restaurants marker, the sound continues to play until the end of the sound file before stopping. A better method would be to write an enterFrame handler at the Restaurants marker that checks to see if a sound is playing, and, if one is, stops it. To control a sound with Lingo, we will use the sound isBusy and sound stop commands. Both commands allow you to specify a sound channel, so sounds can be controlled individually using Lingo. The sound isBusy command returns TRUE if a sound is playing in the specified channel, so it is perfect for use in an if statement. 1. Double-click the behavior channel at frame 20to open a Script window. Delete the default han- dler and replace it with the following: on enterFrame