- If I want to keep all my actionscript in frame 1 of the main timeline, and I drag a movie clip (called Tent_main) onto the stage and give it the instance name tm, how can I set the depth without having to going into the movieclips timeline? I hope that makes sense- I’d just like to keep all the actionscript in one place, because I’m already easily confused.
- Is there a way to fix this code so it doesn’t overlap everything in the movie. I’ve tried different depths and “getNextHighestDepth” an nothing works. Here is the code (which I didn’t write… I can’t remember where I got it:()
var numStars:Number = 500;
this.createEmptyMovieClip("starField_mc", 1);
var dice:Number;
for (i=1; i<=numStars; i++) {
_root.starField_mc.attachMovie("star", "star"+i, i, {_x:Math.random()*Stage.width, _y:Math.random()*Stage.height, _alpha:Math.random()*100});
_root.starField_mc["star"+i].tranSpeed = Math.round(Math.random()*10+5);
_root.starField_mc["star"+i].onEnterFrame = function() {
twinkle(this);
if (this.tranDir == 0) {
this._alpha += this.tranSpeed;
if (this._alpha>100) {
this.tranDir = 1;
}
} else {
this._alpha -= this.tranSpeed;
if (this._alpha<60) {
this.tranDir = 0;
}
}
};
}
function twinkle(clip) {
//roll a dice 1-500
//1 in 500 chance of twinkling
dice = Math.round(Math.random()*500);
if (dice == 1) {
clip.play();
}
}
I’m just learnig so any help would be great!