3 Replies Latest reply on May 16, 2007 11:13 AM by 72dolphins

    Navigation Help

    72dolphins
      Hello-
      I am trying to figure out how to do a certain navigation technique in Flash. Essentially, I have a menu screen that has 8 links on it. Whenever a user clicks on one of these links, a transition plays and it leads you to the section you clicked for.

      The transition is the same for every link on the page, but the location you end up at is different. So, for every link you click, the same transition plays, but the user goes to a different section. My question is how to use the same transition, but navigate the user to the correct section when that transition has completed.

      For example, if they click on "LINK A", I want "TRANSITION A" to play and then go to "SCENE A".

      If they click on "LINK B", I want "TRANSITION A" (the same one) to play and then go to "SCENE B".

      So on and so forth. Can you provide me with any direction on how to do this via actionscript?

      Currently I am doing it by just duplicating the transition for every link I need. Each transition then has code at the end that dumps the user into the correct scene. But, there has to be a better way to do this... It seems wasteful.

      Thanks in advance.
        • 1. Re: Navigation Help
          Pop_Clingwrap Level 1
          Declare a variable at the root level that can hold a frame number
          When a link is clicked have it set the variable to the relevent number and tell the transition to play. At the end of the transition use gotoAndPlay(variablename).
          This will send the playhead to different frames in the timeline that can hold your different sections. I would say use frames and frame lables rather than scenes as they are dodgy, unreliable things in my (limited) experience.
          Hope this helped
          • 2. Re: Navigation Help
            72dolphins Level 1
            Okay... Thanks for your help. I have tried doing this, but it doesn't seem to want to read the gotoAndPlay(variablename).

            So, right now I have a scene called "MainMenu". There is a button in this scene that when clicked I want to play another scene called "Transition" and then move to another scene called "What Is". I have the following code attached to the button:
            on (release) {
            _root.sceneVar = "What Is";
            gotoAndPlay("Transition");
            }

            Then, in the scene called "Transition", I have the following code on the final frame:
            gotoAndPlay(_root.sceneVar);

            When I publish, it gets all the way to the final frame, but does not go to the scene that is stored in the variable. In other words, it plays the transition scene, but will not go to the "What Is" scene that is stored in the variable.

            Any ideas?
            • 3. Re: Navigation Help
              72dolphins Level 1
              Okay... I found the answer to the errors here:
              http://www.quip.net/blog/2006/flash/actionscript-20/gotoandplay-with-scenes

              Apparently, the answer is to only reference frame labels and not scenes. Also, there needs to be a "_root" added before the "gotoAndPlay".

              Needless to say, I will never use scenes again, and just rely on movie clips!