3 Replies Latest reply on Jul 5, 2008 9:07 AM by VarioPegged

    mx:Move question

    Varangian Level 1
      I'm moving an Image using the mx:Move component an amount of X and Y

      Is there a way (perhaps an event) that fires for every x and y the Image moves when playing the mx:Move component? Because I need to check for collision with each X and Y movement the Image does.

      Currently I'm using the endEffect (I check for collision if it doesn't collide play again) event but this seems to be heavy on the flash player and is slow even though the duration is 1.

      Any suggestions?
      Thanks!
        • 1. Re: mx:Move question
          VarioPegged Level 2
          Have you tried using the tweenUpdate event of mx:Move?

          It might be something like this:

          <mx:Move ..... tweenUpdate="onTweenUpdate(event)" ...... />

          private function onTweenUpdate(event:TweenEvent):void
          {
          //referring to event.target will get you to the Image that is currently being moved
          // if (event.target.x == blah blah) ....
          // if (event.target.y == blah blah) ....
          }

          TS
          • 2. mx:Move question
            Varangian Level 1
            thanks VarioPegged...

            when does tweenEvent fires though? or tweenUpdate fires?
            • 3. Re: mx:Move question
              VarioPegged Level 2
              From the docs: " tweenUpdate Dispatched every time the tween effect updates the target."

              I noticed an error in my code above (referring to the moved object in the listener function):
              ........
              // if (event.currentTarget.target.x == blah blah) ....
              // if (event.currentTarget.target.y == blah blah) ....
              .......
              TS