1 Reply Latest reply on Nov 5, 2008 7:04 PM by Chunick

    Need help interrupting event on a timer

    adam@blueapplestudio Level 1
      I am using a timeout to scale a 3D object over time, and everything looks good (see attached code.)

      Now I need to allow the user to interrupt the scaling by hitting the space bar. I created a keyDownScript, but I need to forget the timeout object from the keydown script. Now, the variable for the timeout object is local to the shrink function, so I can't simply forget the timeout from my keydown script. I tried making the timeout variable a global so I could access it from the kydown script, however that created other problems. What should I do here?

      Any help is appreciated.
        • 1. Re: Need help interrupting event on a timer
          Chunick Level 3
          create a function that will forget your timeout object in the same script as your other functions:

          function fStopShrink() {
          tShrinkTimeOut = null;

          and call it using sendAllSprites:

          sendAllSprites(#fStopShrink) -- sorry, don't know the javascript equivalent... but I'm sure it would be something like this: sendAllSprites(symbol(fStopShrink));