The+GLOBALS+&+SOUND+Layer


 * Using the timeline to control flow in an activity depending on whether narration is on or off:**

If you take a look at the globals & sound layer of the activity template you will see the following starting on frame 2: code format="actionscript" stopAllSounds; if (this._parent.usingNarration) { startNewNarrationSound("InsertSoundFileNameHere.mp3"); setPauseAndSoundFinished(false,true,true,"ignore"); } else { setPauseAndSoundFinished(false,false,true,"ignore"); } code However, above __//almost// every__ frame of code in your activity you need a keyframe in the GLOBALS & SOUND layer that contains code depending on the frame below it: code format="actionscript" setPauseAndSoundFinished(false,false,true,"ignore"); code code format="actionscript" stopAllSounds; if (this._parent.usingNarration) { startNewNarrationSound("InsertSoundFileNameHere.mp3"); setPauseAndSoundFinished(false,true,true,"ignore"); } else { setPauseAndSoundFinished(false,false,true,"ignore"); //Something may need to go here } code
 * IF there is no new text showing that will be narrated in that frame, then the globals and sound layer frame should have ONLY the following code:
 * Otherwise it will contain the following code with minor adjustments to some of the peices parts as described below:

PART 1:
code format="actionscript" stopAllSounds; code //should only be there if you want any sound before this frame to be cancelled should the user land on this frame before the sound from the last frame was finished (usually the case)//

PART 2:
code format="actionscript" if (this._parent.usingNarration) { startNewNarrationSound("InsertSoundFileNameHere.mp3"); setPauseAndSoundFinished(false,true,true,"ignore"); code //This says what to do when the narration is on – for now, you really just need to fill in the “ ignore ” part as://

**“ignore”** if the timeline is being controlled by the frame below e.g. user input will be required or a transform finishing does the work (i.e. you have a onMovieClipComplete with a showcontinue or a play in it) **“play”** if the timeline should advance when the narration is finished **“showcontinue”** if the continue button should pop up when narration is finished.

PART 3:
code format="actionscript" } else { setPauseAndSoundFinished(false,false,true,"ignore"); //something may need to go here } code This says what to do when the narration is OFF – replace the “something may need to go here” part as follows://

Note: The '0' in the above is the length of the wait before the call to play. So if you'd like a small delay between each piece of text appearing (i.e. appearing one after another instead of at the same time) then change the zero the number of milliseconds the timeline should pause before calling the play. “**showcontinue**” if the continue button needs to appear when the text is on the stage **(nothing i.e. leave it blank)** if the actions frame will control the timeline
 * “delayCall(play, 0)” ** if the text that is being shown on this frame should be shown together with the next frame’s text.

//NOTE: The above only works if you have a stop; at the top of the actions frame too!//
= = =EXAMPLE:= Storyboard says - show Gus' speech bubble - when narration is complete show Aggy's speech bubble - when narration is complete show continue button If narration is off, show the two speech bubbles together with the continue button. code format="actionscript" stopAllSounds;
 * || Frame 4 || Frame 5 ||
 * Globals & Sound ||

if (this._parent.usingNarration) { startNewNarrationSound("S3F4.mp3"); setPauseAndSoundFinished(false,true,true,"play"); } else { setPauseAndSoundFinished(false,false,true,"ignore"); delayCall(play, 0); } code || code format="actionscript" stopAllSounds;

if (this._parent.usingNarration) { startNewNarrationSound("S3F5.mp3"); setPauseAndSoundFinished(false,true,true,"showcontinue"); } else { setPauseAndSoundFinished(false,false,true,"ignore"); showcontinue; } code || gusSpeech_mc._visible=true; || stop; aggySpeech_mc._visible=true; ||
 * Actions || stop;