flash actionscript:
I am loading .mp3 files at different points in a long presentation so that the sound stays in sync. Each .mp3 file is named 'VO' (for 'voice over') plus a number and they are loaded as needed sequentially as the presentation moves along. Since the presentation is long, I have a 'skip forward' button that allows the user to move to where the next sound file starts. Frame labels named the same as the corresponding .mp3 files are used for navigation buttons. It all works great if I run the presentation from a projector file, and also works great in 'Test Movie'. Unfortunately, when I try it in a browser, the presentation skips forward to the frame label indicated when the 'skip forward' button is pressed, but the sound does not start up. I have discovered that if I 'skip back' and then 'skip forward' again, the sound then starts just fine. So why doesn't it start the first time I skip forward? And why, if there is an issue with the code, does it work in the projector file? See code snippets, below. All thoughts greatly appreciated. TIA, Carolyn -------------------------------------- Two pieces of code make the button work. One on the button, and one in the target frame that is skipped to. Here's what I've got: On the 'skip forward' button: // skip to beginning of next section on (release, releaseOutside) { //stop current narration _root['VO'+SoundNum].stop(); // determine frame label for next section NextSound = SoundNum + 1; NextLabel = 'VO'+NextSound // go to beginning of next section _root.gotoAndPlay(NextLabel); } And on the frame defined as 'NextLabel': // set variable to indicate current narration track // variable used by navigation buttons SoundNum = 3; //create sound object VO3 = new Sound(); // start next narration // load .mp3 dynamically as streaming object VO3.loadSound('VO_3.mp3', false); VO3.start(0,0);
Nevermind. I figured it out. I had to change the 'false' parameter in the ..loadSound to 'true' for a streaming sound. ('False' sets it to an event sound which needs to load completely before it will start to play.) So the line should read: VO3.loadSound('VO_3.mp3', true); Thanks anyway. Carolyn
Don't see what you're looking for? Try a search.
|