This one has me stumped. I’m missing a trick here I think; so why doesn’t this work?
function makeClouds(clouds:Number) {
for (var i=0; i < clouds; i++ ) {
var cloudName:String = "cloud" + i + "_mc";
var cloudStart:Number = Math.round(Math.random() * Stage.width);
this.attachMovie("cloud_mc", cloudName, this.getNextHighestDepth());
debugMessage(cloudName);
this[cloudName]._x = cloudStart;
this[cloudName].onEnterFrame = function() {
debugMessage("moving: " + cloudName);
if (this[cloudName]._x <= -100) {
this[cloudName]._x = Stage.width;
} else {
this[cloudName]._x -= 3;
}
}
}
}
The cloud mcs attach fine and are displayed… but only one of the buggers animates. No errors are displayed. Help!