No Timelines! With one single sentence we create a whole animation from ActionScript
Click Here for part II of this tutorial.
DOWNLOAD THE COMPLETE SOURCE FILE
Fade Control Final
CLICK HERE FOR A COMPLETE ACTIONSCRIPT 3.0 CARTOON SMART TUTORIAL
HERE IS THE SOURCE CODE!
// solutions at say-web dot com
// FREE to USE, COPY and DISTRIBUTE
// Let’s import Tweening Libraries
// This enables Tweeing Capabilities
import fl.transitions.Tween;
import fl.transitions.easing.* // This will import all
//easing capabilities
// Variables to hold the tween
var inTween:Tween;
var outTween:Tween;
//Now we will set the compiler
//to wait the buttons to be clicked
in_btn.addEventListener(MouseEvent.CLICK, fadeIn);
out_btn.addEventListener(MouseEvent.CLICK, fadeOut);
// Note the instance names have to be identical
// to the names we gave on stage
//Functions
//if any event listener has a function that is not declared
// a error message shows, even if the button is not clicked
function fadeIn(event:MouseEvent):void{
inTween = new Tween (sun_mc,”alpha”,None.easeNone,0,1,3,true);
// sun_mc is the instance name we gave on stage
// alpha is a string HAS to be in between quotes
// The opacitiy starts at 0 increasing all the way to 3, steady
// during 3 seconds
// the true is to state we are using seconds and not milliseconds
}
function fadeOut(event:MouseEvent):void{
inTween = new Tween (sun_mc,”alpha”,None.easeNone,1,0,3,true);
}
// Don’t forget to subscribe
//thanks for watching



































Wed, Oct 28, 2009
ActionScript