TweenLite ignoring specific properties
My name is Anubhav! I was developing a Arkanoid style game in AS3. And I am having some problems with the following TweenLite co开发者_JAVA技巧de :
TweenLite.to(costume, 1, {
alpha: 0,
y: posY,
scaleX: 0,
scaleY: 0,
rotation: 30,
onComplete: function() {
dispatchEvent(new BrickEvent(BrickEvent.HIT_BALL));
},
overwrite: OverwriteManager.CONCURRENT
});
The above code is fired when a ball hits a brick (to animate the brick costume). The problem is that Tweenlite is just changing the alpha
, scaleX
and scaleY
properties while y
and rotation
properties remain untouched. I tried using TweenMax and changing the overwrite options to NONE
, ALLONSTART
, ALLIMMEDIATE
etc. but none of them is working. I have no idea why this is happening. Please help me out! :)
It might have to do with the action occuring before the ball hit the wall. Make sure you remove all tweens and other actions that affects the ball. If you are moving the ball with a tween them the overwrite:true should take care of it. You could also use tweenLite.removeAllTweens(ball). Not sure if that is the correct method name though.
Oh I figured out the mistake! I'm such a fool! Actually I am using Box2D as the Physics Engine to take care of the collisions involved and it wasn't letting me change the position and rotation properties. Anyways thank you Mattias for your help! :)
精彩评论