4 Replies Latest reply on Oct 3, 2007 11:29 PM by

    Problems with gotoAndPlay

      I am having trouble getting a button to work in my Flash 8 project.
      I have 52 frames that make up an intro to my project. I have an "Actions" Layer on which I have inserted a keyframe on frame 52. In the Actions of frame 52 of this layer I typed:
      stop();
      On a different layer, on frame 52, I added a movie clip button which has a keyframe and an image for Up, Over, Down, and Hit.
      In the Actions of frame 52 of this layer I typed:
      on release() {
      gotoAndPlay(53);
      }

      On frame 53, the background changes. However, when I test the movie, the intro works great and stops fine on frame 52. The rollover and mouse down images for the button work great, but nothing happens when I click the button. I also tried using the code below.
      on release() {
      _root.gotoAndPlay(_root._currentframe+1);
      }

      Any ideas about what I am doing wrong?
        • 1. Re: Problems with gotoAndPlay
          michaeltowse Level 1
          Sounds like you need to either add the script to the button component or reference the button component within the script itself.

          yourButton.onRelease = function(){
          _parent.gotoAndPlay(53);
          }

          add that to the timeline and ensure your movieclip/button element is named yourButton.

          Hope this helps.
          1 person found this helpful
          • 2. Re: Problems with gotoAndPlay
            Thanks, Michael.
            I had tried that, as well, but nothing was working.
            I think it might have something to do with the version of Flash Player.
            I finally deleted the button and created a new symbol just using one bitmap, and it started working.
            However, I don't get the changes in the look of the button now when I do a rollover and a click.
            I'm still using Flash 8. I'm sure if I upgraded, some of these problems would go away, but that's out of my budget right now.
            • 3. Re: Problems with gotoAndPlay
              clbeech Level 3
              No you don't need to upgrade, AS2 still works just fine. Michael is correct, when placing an 'on handle'r on the timeline you need to use the format he's descibed above, with the exception of the '_parent' tag, in this case. just use

              yourButton.onRelease = function() {
              gotoAndPlay(53);
              }

              and it should work. Remember to give it the 'instance name' of 'yourButton' (in this case) to the button or mc symbol OR change the name in the script to that of the instance name you currently have on the button.
              1 person found this helpful
              • 4. Re: Problems with gotoAndPlay
                I'm quite sure that I was doing everything right. I re-created a new button as a symbo, rather than a movie with the onOver, onMouseDown and onHit keys, and it worked.
                I'm wondering if I just didn't create a box around the button. I've seen people do that in demos, but they do it so quickly, I don't know what tool they are using.