Link to home
Start Free TrialLog in
Avatar of Hori76
Hori76

asked on

Animate a Movieclip in AS3 with Tweener by MouseOver and MouseOut

I have 4 buttons, when I roll over a button it needs to fade-in a text on stage. When I roll-out it needs to fade out the text.
I did the fade-in and fade-out with the tweener class, but it only works 1 time, after that, the instance of the text stays on stage and doesn't fade-out anymore.

I don't want to do this with the timeline in the MovieClip, because I need more control over the MovieClip.

This is the script I already have, like I said, it only works once. Can someone tell me what I'm doing wrong?
nav.zwembaden.addEventListener(MouseEvent.MOUSE_OVER, zwembaden_MOUSEOVER);
nav.zwembaden.addEventListener(MouseEvent.MOUSE_OUT, zwembaden_MOUSEOUT);
 
function zwembaden_MOUSEOVER(e:MouseEvent):void
{
	var mcLink:MovieClip = new mc_links();
	mcLink.linktext.text = "ZWEMBADEN";
	mcLink.name = "mcLink_zwembaden";
	addChild(mcLink);
	mcLink.alpha = 0;
	mcLink.blendMode = BlendMode.LAYER;
	Tweener.addTween(mcLink, {alpha:1, time:1, transition:"easeInSine"});
}
 
function zwembaden_MOUSEOUT(e:MouseEvent):void
{
	Tweener.addTween(getChildByName("mcLink_zwembaden"), {alpha:0, time:1, transition:"easeInSine"});
        //stage.removeChild(stage.getChildByName("mcLink_zwembaden"));
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dreammonkey
Dreammonkey
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hori76
Hori76

ASKER

Thanks, just what I was looking for!
Unfortunately it's not my swimming pool... :)

function zwembaden_MOUSEOVER(e:MouseEvent):void
{ 
        Tweener.addTween(mcLink, {alpha:1, time:1, transition:"easeInSine"});
}
 
function zwembaden_MOUSEOUT(e:MouseEvent):void
{
        Tweener.addTween(mcLink, {alpha:0, time:1, transition:"easeInSine"});
}

Open in new window