Copy link to clipboard
Copied
I have a card flip animation (actually many card flips) using the greensock Classes.
I have the followig code:
import com.greensock.*;
import com.greensock.easing.*;
flipper.back.rotationY = -90;
flipper.back.alpha=0;
var flipSpeed:Number = .1;
var tl:TimelineMax = new TimelineMax({paused:true});
tl.append(TweenMax.to(flipper.front, flipSpeed, {rotationY:90, visible:false, ease:Linear.easeNone}))
tl.append(TweenMax.to(flipper.back, 0, {alpha:1, immediateRender:false}))
tl.append(TweenMax.to(flipper.back, flipSpeed, {rotationY:0, ease:Linear.easeNone}))
flipper.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
function onMouseOver(evt:MouseEvent):void {tl.tweenTo(tl.duration);}
flipper.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
function onMouseOut(evt:MouseEvent):void{tl.tweenTo(0);}
The problem is that there are moments when the mouse is over the Movieclips that the Movieclips flicker (they sort of keep animating) Is there a better way to code this so that I don't get thet MovieClip flicker?
Thanks for any help.
Copy link to clipboard
Copied
What might help is to remove the mouseover event listener in the onMouseOver function and restore it if it needs to be restored in the onMouseOut function
Copy link to clipboard
Copied
Hello Ned:
I put the listener in the MouseOut function but it still flickers.
Copy link to clipboard
Copied
What you should do is see if you are having a problem where the object is getting stuck in a mouseover / mouseout cycle due to its flipping. You can do this by putting traces in your functions to see if they are firing repeatedly. If that is the case, then you may need to hold off assigning the mouseout until after the flip has occured.
Copy link to clipboard
Copied
Hello Ned:
Ive tried this (putting the function inside the MouseOver function) and it stil flickers:
import com.greensock.*;
import com.greensock.easing.*;
flipper.back.rotationY = -90;
flipper.back.alpha=0;
var flipSpeed:Number = .1;
var tl:TimelineMax = new TimelineMax({paused:true});
tl.append(TweenMax.to(flipper.front, flipSpeed, {rotationY:90, visible:false, ease:Linear.easeNone}))
tl.append(TweenMax.to(flipper.back, 0, {alpha:1, immediateRender:false}))
tl.append(TweenMax.to(flipper.back, flipSpeed, {rotationY:0, ease:Linear.easeNone}))
flipper.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
function onMouseOver(evt:MouseEvent):void {tl.tweenTo(tl.duration);
flipper.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
}
function onMouseOut(evt:MouseEvent):void{tl.tweenTo(0);}
Any other suggestions?