1 Reply Latest reply on Jul 20, 2006 8:06 AM by Tolk

    flash tween class problem

    Level 7

      I have menu links which when clicked do the following:

      var div2Tween:Tween = new Tween(mcDivider2, "_x", Strong.easeOut,
      divider2X+15, divider2XFinish, .4, true);
      div2Tween.onMotionFinished = function() {

      the code and tween work fine, but if the user clicks the button repeatedly
      say for instance its clicked 5 times, the dispContent() function is called 5
      times. However I would have thought that the tween is overwritten or
      cancelled when the tween is called again? meaning that the dispContent()
      only runs once if the user clicks the button repeatedly as the tween would
      only finish once?

      Any help or advice is appreciated!!


        • 1. flash tween class problem
          I'm not sure if theres a fix or not, the mx tween classes are useful but dodgy at their best.

          A workaround:

          1) After the button has been clicked, disable the button. In the onMotionFinished event re-enable the button. i.e. they cant use the button until the animation has finished.

          2) I'm not sure if this will work, havent tested it: on the button script add:

          delete div2Tween;

          before the tween var is defined. if there is no tween var it wont delete anything, if there's already one there it should delete it. The effect of what will happen to the tween i do not know.