1 Reply Latest reply on May 28, 2008 11:16 AM by cre8ive1974

    goto and play variable set

    blackhawks
      I am trying to set the 'goto and play' function so that it will go back and start from frame 1 a set number of times before continuing to the next frame. How do I do this?
        • 1. Re: goto and play variable set
          cre8ive1974 Level 1
          you can set a _global variable equal to 0 like this
          _global.myCount = 0

          then on your MC timeline on the last frame before you want it to go to the start again you can use this as a loop
          _global.myCycle= myCount++
          _root.MC.gotoAndPlay(1)
          if(_global.myCycle==10){
          _root.MC.gotoAndPlay(20)
          }

          What happens is MC will play until it hits the above code and evaluates it. It will take "myCount" and add 1 to it. Then assigns that number to another varaible "myCycle". Then it checks to see if myCycle equals 10, if it does not it will go back to frame 1 and play again. This time around "myCount" will be one more higher than before and re-evaluates the "myCycle" again etc.
          Once "myCycle" equals 10 it goes to the next frame and the code stops cycling.