tween switch text



import fl.transitions.*;
import fl.transitions.easing.*;

var myTextFormat:TextFormat = new TextFormat();
myTextFormat.align = TextFormatAlign.LEFT;
txt.s.setTextFormat(myTextFormat);

btn1.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
btn1.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);

var myTM:TransitionManager = new TransitionManager(txt);

function onMouseOver(event:MouseEvent):void
{
switch (event.currentTarget)
{
case btn1 :
txt.s.text = "NEEMA,\nMiss Africa";
txt.x = 195;
txt.y = 190;
break;

}
//TransitionManager.start(my_mc,{type:Fly, direction:Transition.IN, duration:2, easing:Strong.easeOut})
myTM.startTransition({type:Fade, direction:Transition.IN, duration:1, easing:Strong.easeOut});
//var myTween:Tween = new Tween(object, "property", EasingType, begin, end, duration, useSeconds);
var myTween:Tween = new Tween(txt, "y", Strong.easeOut, (txt.y+20), txt.y, 1, true);
txt.visible = true;

}
function onMouseOut(event:MouseEvent):void
{

//TransitionManager.start(my_mc,{type:Fly, direction:Transition.IN, duration:2, easing:Strong.easeOut})
myTM.startTransition({type:Fade, direction:Transition.OUT, duration:1, easing:Strong.easeOut});
//var myTween:Tween = new Tween(object, "property", EasingType, begin, end, duration, useSeconds);
var myTween:Tween = new Tween(txt, "y", Strong.easeOut, (txt.y-20), txt.y, 1, true);
txt.visible = false;
}

0 comments:

Post a Comment