Posted on December 24th, 2006 10:04 PM by hewhocorruptsyou

Tweening Alpha (opacity) with actionscript
Difficulty: Intermediate
Type: flash
Rate this tutorial: You must be logged in to rate tutorials
Rating: with 3 votes





 

Download the FLA file 

This script will allow you to use actionscript to animate content, buttons, pretty
much anything you want to change in size, using actionscript.


this actionscript that sets the parameters of the tween:

 


function Fade(mc, alpha) {

var type = mx.transitions.easing.Regular.easeInOut

var start = mc._alpha

var end = alpha

var time = 20



tabmove = new mx.transitions.Tween(mc, "_alpha", type, start, end, time, false);
}


What does that mean?


light blue text:Type of Easing (other options:Back, Elastic, Strong, Bounce all are case sensitive)

green Text:When to Ease(other options:EaseIn, EaseOut all are case sensitive)

Blue Text:amount of frames the tween will take


Then to make the Object move use this actionscript, on the actions layers


Fade(instancename,100);


What does that mean?

light blue text:the instance name of the movieclip you are fading

green Text:what opacity you want it to be at the end of the tween(so 100=100%, 50=50% etc)


you may also put it into an onRollOver event, or an onRelease event:


button.onRelease = function(){
Fade(instancename,100);
}



What does that mean?

light blue text:the instance name of the buttton

green Text:the event (other options:onRollOver, onRollOut, onPress, etc.)






Back to tutorials

Sponsored Link



No comments have been left on this tutorial