1 Reply Latest reply on Aug 22, 2008 8:16 PM by

    Navigation issue with Frame Markers in AS2

      I'm trying to create a system where I can use a "back" button to return to whichever screen the user was on before they got to the screen with the "back" button.

      So for example, they could start on screen 1, 2, or 3, go to the screen with the "back" button, and upon clicking the back button, be taken to whichever screen they were last on. It's not linear navigation, so prevFrame etc. won't work. If this doesn't make sense, a detailed description of my setup follows.

      The way I'm doing this is by using frame labels and actionscript which sets a variable called prevPage to a string which is the name of the frame label. Then, the "back" button uses gotoAndStop(prevPage); to navigate to whichever frame label the prevPage variable was last set to mimic.

      So here's what I've got going on (a simple .fla to test this out):

      Two scenes:
      - Scene 1
      - Scene 2

      Scene 1 has two frames:
      - frame 1 is labeled: tableConts
      - frame 2 is labeled: videoOne

      Scene 2 has one frame:
      -frame 1 is labeled: helpScreen

      On Scene 1, frames 1 and 2, there are three buttons with the respective on(release) scripts:
      gotoAndStop("tableConts");

      gotoAndStop("videoOne");

      gotoAndStop("helpScreen");


      These buttons function as expected.

      Also, on Scene 1, frames 1 and 2 both have keyframes with Actionscript setting the prevPage variable to "videoOne" or "helpScreen" (dependent on which frame marker they are mimicing). Since there is no way to call up the frameLabel in AS2, this was the method I came up with.

      On Scene 2, frame 1, there is one button (the "back" button) with the following on(release) script:
      trace(prevPage);
      gotoAndStop(prevPage);


      Here's the problem: the "back" button is not functioning. The screen does not change when it is clicked.

      However, the trace(prevPage); command does output the string prevPage was set to by the frame script on the frames in Scene 1. So, it looks like prevPage is set to the correct string, but somehow is not working when used in the gotoAndStop(prevPage); command on the "back" button.

      I don't get what's up. At first I thought it was a scope issue, but because the prevPage variable is returning the expected data when traced, it doesn't seem like this is the case.

      Any help is appreciated! Thanks!
        • 1. Re: Navigation issue with Frame Markers in AS2
          New development in my problem:

          If on the "back" button, I specify the scene, like below:

          on (release) {
          trace(prevPage);
          gotoAndStop("Scene 1", prevPage);
          }

          It works. So, problem partially solved. Now I'll still need to use a variable in place of "Scene 1" so that this can work in movies with multiple scenes. Any tips on how to do that?

          I don't get why it doesn't work without the scene name. The button in scene 1 which leads to the screen with the "back" button (which is in scene 2) works without specifying the scene name.