Multiple ActionScript on the same flash document
Hi, everyone. I am very new in flash, and espcially in actionscript.
I have been able to insert the template of snow with the action layer that comes with it. Using these layers alone with the rest of the project. Everything works fine. But when I create other keyframes with action of blinking stars on the same project. Even if they are on the same action layer or on differents layers, the actionscripts of the blinking stars work, but the one with the snow doesn’t work anymore.
I put my actions script below, can someone help me with this problem.
SNOW
// Number of symbols to add.
const NUM_SYMBOLS:uint = 75;
var symbolsArray:Array = [];
var idx:uint;
var flake:Snow;
for (idx = 0; idx < NUM_SYMBOLS; idx++) {
flake = new Snow();
addChild(flake);
symbolsArray.push(flake);
// Call randomInterval() after 0 to a given ms.
setTimeout(randomInterval, int(Math.random() * 10000), flake);
}
function randomInterval(target:Snow):void {
// Set the current Snow instance's x and y property
target.x = Math.random()* 550-50;
target.y = -Math.random() * 200;
//randomly scale the x and y
var ranScale:Number = Math.random() * 3;
target.scaleX = ranScale;
target.scaleY = ranScale;
var tween:String;
// ranScale is between 0.0 and 1.0
if (ranScale < 1) {
tween = "slow";
// ranScale is between 1.0 and 2.0
} else if (ranScale < 2) {
tween = "medium";
// ranScale is between 2.0 and 3.0
} else {
tween = "fast";
}
//assign tween nested in myClip
myClip[tween].addTarget(target);
}
BLINKING STARS
for (var m =0;m<50;m++) {
star1_mc.duplicateMovieClip("star1_mc"+m,m,{_x:Math.random()*350,_y:Math.random()*150});
root["star1_mc"+m].gotoAndPlay(random(30));
}
Thanks in advance