I have a function with Enter_Frame running and have it tween during the function. I know you could use object.y=object.y + 1 instead of the TweenLite i'm using now. But TweenLite gives the best effect I wanted. My problem now is, I wanted to remove the enter_frame function when its not collision each other. But when I traced hitTestObject, it have like a split second where the hitTestObject result return 'false'. So the tweening can't really finish 1st, and remove enter_frame run early while the object is still collisioning.
private function checkCollision (e:Event):void
{
//detect collision in array
for (var j:uint = 0; j < collisionArray.length - 1; j++)
{
for (var k:uint = j + 1; k < collisionArray.length; k++)
{
if (collisionArray[j].hitTestObject(collisionArray[k]))
{
//do something
TweenLite.to (objectA,0.2,{y:move2Y});
TweenLite.to (objectB,0.2,{y:move3Y});
}
trace (collisionArray[j].hitTestObject(collisionArray[k]));
}
}
}