Link to home
Start Free TrialLog in
Avatar of AsWas
AsWas

asked on

previous and next buttons

Ugh, I'm redoing my Flash file as a regular file with scenes rather than a slide presentation since I can't find anybody who can tell me how to trigger sounds in each slide the way I need. See https://www.experts-exchange.com/questions/20785367/sound-in-slide-presentations.html if you can.

So I'm building another Flash file again in a different way. I now have a Flash file with multiple scenes (and no slides). Each scene is a "screen" in a presentation, and each scene triggers an MP3 to play. So far, it's working fine. The scenes are playing the right sounds and sounds are stopping if you leave the scene before the sound ends. What's not working now are my previous and next buttons.

I have them in layer 1 of each scene, and their action is, for example:

on (release) {
      stopAllSounds();
      nextScene();
}

The problem there is that scene 1 goes to scene 2. Scene 2 stops the sound but doesn't move to scene 3. Yes, they are in the right order in the scenes panel. So right now, I can only go between scenes 1 and 2. I thought this might have something to do with the behaviour being the same for the buttons as they are copied and pasted to each scene. However, "nextScene" should always be the next scene whether that's from 1 to 2, 2 to 3, or 39 to 40. Yes?

This is my script for the sound playing and the scene stopping to wait for the user to click a button:

if(!_global.soundtrack){
   _global.soundtrack = new Sound();
   soundtrack.onSoundComplete = stop()
   {
       this.start(0, 1);
   }
   soundtrack.loadSound("slide02.mp3", true); // loadSound
} else {
   soundtrack.stop();
   soundtrack.loadSound("slide02.mp3", true); // loadSound
}

Each mp3 is named for the screen it goes with, so I have 40 mp3 files ready for action. I just need the prev and next buttons to do what they say!!!!

Please help!

Thanks,
Debbie
ASKER CERTIFIED SOLUTION
Avatar of negatyve
negatyve

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AsWas
AsWas

ASKER

Yes, I'd love an example of a Flash SLIDE PRESENTATION where the sound works as I said. My email is deb@aswas.com.

Meanwhile, this isn't working. The scenes are named Scene 1, Scene 2, etc... My code is:

on (release) {
      stopAllSounds();
      _root.gotoAndPlay("Scene 2");
}

When I click that button, the sound stops and the screen does NOT move to Scene 2. This is driving me CRAZY. I can't believe that I can't get something so simple to work. I'm going out of my mind over this. I hope that you can help with either the sounds in the slides OR this next and previous thing as you'd think it's easy enough.

If you can solve either or both for me, I'm happy to give you the points from both.

Thanks,
Debbie
Avatar of AsWas

ASKER

Does this have anything to do with this being the same button in frame 1 of every scene? Should the system think these are diff buttons or diff BehaviourObjects for each scene?
no no, it's a problem with scene. scene don't mean anything, they just work on authoring time, not on reproduction. uploading an example in a few minutes..
Avatar of AsWas

ASKER

How odd. I'd think that if I name "scene 1" that and then we say gotoandplay "scene 1," it should just do that!

Thanks in advance for the examples.
Avatar of AsWas

ASKER

I copied and pasted the code I saw into mine, but it gave me this:

**Error** Symbol=presentation, layer=MM_Screen_Layer, frame=1:Line 2: Statement must appear within on/onClipEvent handler
     this.stop();

**Error** Symbol=presentation, layer=MM_Screen_Layer, frame=1:Line 4: Statement must appear within on/onClipEvent handler
     if(!this.once){

**Error** Symbol=presentation, layer=MM_Screen_Layer, frame=1:Line 74: Statement must appear within on/onClipEvent handler
     sceneInfo.current = 0;

Total ActionScript Errors: 3        Reported Errors: 3

==========================================

So I have a few questions:

1) Do I put in the slide/scene name for each one in that big block of code? I have 44 slides total - do I need all 44 in there?

2) I don't know where to put the sceneInfo.current thingy.

3) I don't know where to put the onClip thingy.

4) I don't know how you coded your next and previous buttons since they don't seem to be symbols.

So you sent me something that works, and that's exciting, but I have NO idea how to integrate what you've done into my file.

Thanks,
Debbie
>I copied and pasted the code I saw into mine, but it gave me this: {error }

because you are trying to past that code to a movieclip, while it is a frame code

>Do I put in the slide/scene name for each one in that big block of code? I have 44 slides total - do I need all 44 in there?

yes. do not rely on scene (or, if your scenes have all the same frame number, you can use number in the sceneArray array, and avoid setting the first frame labels)

>I don't know where to put the sceneInfo.current thingy.

on the first frame of every scene, write:

sceneInfo.current  = {current scene number: 1 if the scene is the first one, 22 if it's the 22th, 43 if it is the 43rd...}

>I don't know how you coded your next and previous buttons since they don't seem to be symbols.

just select the button, and open the actions panel. actually they are components, but in this example i have treated them as common buttons
Avatar of AsWas

ASKER

Hey. I ended up needing help from someone else to finish, but I appreciate the time you took. I will give you the points in both questions. Thanks again.