5 Replies Latest reply on May 2, 2006 3:56 PM by goldfingeratb

    Annoyingly simple

    goldfingeratb
      Hey,

      This is such an elementary problem which I am sure everyone one of you could solve, but at the moment I cannot do it and its giving me a headache. Basically I have a button with an instance name of goPlay_btn and I want it to go to Scene 8 on release. I have tried all the usual methods but I keep getting this error:

      Statement must appear within on handler

      This is the code I have put in:

      goPlay_btn.onRelease = function (){
      gotoAndPlay("Scene 8", 1);
      };


      What is going wrong?!

      Any help appreciated!

      Regards,

      Adam Justice
        • 1. Re: Annoyingly simple
          Level 7
          Looks like you are trying to put this code on a button or some other symbol.
          Put it on the timeline.

          --

          Dan Mode
          *Must Read* http://www.smithmediafusion.com/blog
          *Flash Helps* http://www.smithmediafusion.com/blog/?cat=11

          "goldfingeratb" <webforumsuser@macromedia.com> wrote in message
          news:e38k40$e31$1@forums.macromedia.com...
          > Hey,
          >
          > This is such an elementary problem which I am sure everyone one of you
          > could
          > solve, but at the moment I cannot do it and its giving me a headache.
          > Basically
          > I have a button with an instance name of goPlay_btn and I want it to go to
          > Scene 8 on release. I have tried all the usual methods but I keep getting
          > this
          > error:
          >
          > Statement must appear within on handler
          >
          > This is the code I have put in:
          >
          > goPlay_btn.onRelease = function (){
          > gotoAndPlay("Scene 8", 1);
          > };
          >
          > What is going wrong?!
          >
          > Any help appreciated!
          >
          > Regards,
          >
          > Adam Justice
          >


          • 2. Re: Annoyingly simple
            boxdoctor
            Hi Adam.....funny my last name is Justice as well. I take it this code is appearing on your main timeline and not inside the timeline of another clip or on the button itself.

            That being said did you try:

            goPlay_btn.onRelease = function() {
            gotoAndPlay("Scene 8");
            }

            also try:

            goPlay_btn.onRelease = function() {
            gotoAndPlay(8);
            }

            Just to make sure you don't have a frame name issue.

            Let me know.


            • 3. Re: Annoyingly simple
              Bishop[Neo] Level 1
              You have to specify the name of the scene, not Scene 8 unless that is the actually name. For instance if the 3rd scene is named scene_number_three you would use
              gotoAndPlay("scene_number_three") not gotoAndPlay("Scene 3");

              You don't *need* a frame number as it will assume frame 1, unless you don't want frame 1. Becareful you aren't accidentally refering to a frame.

              BTW, gotoAndPlay(8); will play from frame 8 of the current movie and timeline
              • 4. Re: Annoyingly simple
                Bishop[Neo] Level 1
                Also, where did you put the AS? Best bet would be on the button itself, then you only need:
                on (release) {
                gotoAndPlay("scene_name");
                }
                • 5. Re: Annoyingly simple
                  goldfingeratb Level 1
                  Hey thanks everyone, I ended up just putting the code in the timeline, and then it worked.

                  Thanks!