3 Replies Latest reply on Sep 13, 2007 3:16 AM by michaeltowse

    interval for onEnterFrame

      hi all ...

      how can i make the onEnterFrame work only for a set of intervals?

      my code is

      button.onRollOver = function () {
      onEnterFrame = function () {

      so it goes all the way to the frame 0 ... can i make it work only between a set of frames? lets say 20 frames???
      and keep the rest unaffected with the onEnterFrame

      thnx in advance for your help

        • 1. Re: interval for onEnterFrame
          Rothrock Level 5
          Well you have a nice onEnterFrame happening every frame. So all you have to do is add some code in there that tells it what you want it to do. I don't know what you really want it to do, but let's say that when it gets to frame 1 (there is no frame 0!) you would like the onEnterFrame to stop. Inside the onEnterFrame function you would replace what you currently have with something like this:

          } else {
          delete this.onEnterFrame;

          Or if you wanted this to loop you might do something like this:

          } else {

          The possibilities are endless, you just have to tell Flash what you want to happen.
          • 2. Re: interval for onEnterFrame
            archloxx Level 1
            well ... thank you so much ... you made my day :)

            but i wonder ... what does the term: " this " do???
            • 3. Re: interval for onEnterFrame
              michaeltowse Level 1
              the term 'this' is a reference to the instance itself. In the case above i'm guessing it's referencing the root timeline.