Groups | Blog | Home
all groups > flash actionscript > december 2004 >

flash actionscript : What's the code to tween a symbol?



Rich146
12/17/2004 11:16:56 PM
I have been using the timeline to motion tween the alpha so symbols appear
gradualy . I know there is a way to do it with code. Let's say I want to attach
the code to a button and have a symbol gradually appear on stage. What would I
use?
NSurveyor
12/17/2004 11:41:56 PM
Place this script on the frame that holds your button abd symbol.

myButton = instanceNameOfYourButton;
mc = instanceNameOfYourSymbol;
speed = 10;//Every 'SPEED' milleseconds, your mc's alpha will increase by 1
myButton.onPress = function(){
if(whatever == undefined){
whatever = 1;
mc._alpha = 0;
faderID = setInterval(speed,mc);
}
}
function fadeone(mc){
mc._alpha += 1;
if(mc._alpha == 100){
clearInterval(faderID);
}
updateAfterEvent();
}
AddThis Social Bookmark Button