1 Reply Latest reply on Feb 4, 2011 8:34 AM by kglad

    Why wont it gotoAndStop(1)?

    d56_jones

      Hi new here,  after playing the 2 sound files and unloading the movie. the code in a movieclip doesn't seem to want to go back to frame 1!?

       

      I have over movieclips that have the "if (then) {gotoAndStop(x);" so wht not this?

       

      the trace (_root.finished) keeps printing yes, yes , yes....looping and waiting

       

      I expect i have missed something really easy so don't laugh...

       

      Dee

       

      onClipEvent (mouseUp) {

       

          function callback() {

       

              _root.finished = "yes";

       

      //clearInterval(callback);

       

              _root.thumbloader_mc.unloadMovie("thumbs up.swf");

       

                  trace (_root.finished);

       

                  if (_root.finished == "yes") {gotoAndStop (1);}}// why wont it goto this frame?

       

       

       

              {

       

          if ((_root.arrowcardtotal.tharrow == "tharrow" and _root.arrowcardtotal.harrow == "harrow") and (_root.arrowcardtotal.tarrow == "tarrow" and _root.arrowcardtotal.uarrow == "uarrow")) {

       

              //_root.attachMovie("thumb", "thumb", 0, {_x:350, _y:200});

       

              _root.thumbloader_mc.loadMovie("thumbs up.swf", 1);

       

              {

       

              number = new Sound(this);

       

              number.attachSound("well done");

       

              number.onSoundComplete = function () {trace ("");}

       

              number.start(0, 1);

       

              {

       

              number1 = new Sound(this);

       

              number1.attachSound("clapping");

       

              number1.onSoundComplete = setInterval(callback, 3000);// wait

       

              number1.start(0, 1);

       

              {

       

              _root.arrowcardtotal.tharrow = "";

       

              _root.arrowcardtotal.harrow = "";

       

              _root.arrowcardtotal.tarrow = "";

       

              _root.arrowcardtotal.uarrow = "";

       

          }

       

      }}

       

      }}}

        • 1. Re: Why wont it gotoAndStop(1)?
          kglad Adobe Community Professional & MVP

          it's a surprise that code does anything useful.

           

          the first issue, is attaching code to an object.  remove that onClipEvent().  assign an instance name to your object and use:

           

          yourobject.onMouseUp=function(){

           

          }

           

          your second, and more significant problem, is nesting a named function.  never should you nest a named function.  remove callback() from your nesting and attach it directly to a frame.

           

          once you've done that you can start debugging your problems.

           

          p.s.  the onMouseUp event executes whenever the mouse is up, if the mouse is detected over the stage.  it does not only execute when yourobject is clicked.  if you want something to happen when you mouseup while over an object use the onRelease method.