user1399844
user1399844

Reputation:

Flash fadeIn / fadeOut

there is something similar for AC3 like fadeIn, fadeOut from jQuery?

Now I use visible=false but I want to animate this, from opacity 0 to opacity 1

Upvotes: 0

Views: 568

Answers (1)

Shaeldon
Shaeldon

Reputation: 883

You can achiev this with the tween class,this would be a fadein

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

var myTween = new Tween(mc, "alpha", Strong.easeIn, mc.alpha, 1, 3, true);

And here the "naked" one for all Properties:

var myTween:Tween = new Tween(object, "property", EasingType, begin, end, duration, useSeconds);

Reference Here

Also not the the Standard tweening class is not the best to use. It has a lot of problems with simultanious tweens. Best to use Tweenlite/max which can be found here: http://greensock.com/tweenlite

Reagarding comment, its been a long since i done as3 and currently have no method of testing it but this should work or atleast give you enough to fuigure it out. Import point to remeber is that the object must be alpha=0 but NOT visible=false; :

myObject.addEventListener(MouseEvent.MOUSE_OVER,overMouse);
myObject.addEventListener(MouseEvent.MOUSE_OUT,outMouse);

function overMouse(e:MouseEvent):void {
 var myTweenIn = new Tween(myObject, "alpha", Strong.easeIn, myObject.alpha, 1, 3, true);
}
function outMouse(e:MouseEvent):void {
     var myTweenOut = new Tween(myObject, "alpha", Strong.easeIn, myObject.alpha, 0, 3, true);
    }

Upvotes: 3

Related Questions