Hi, I am having trouble creating duplicates of a movieclip that stay behind a mask. They keep overriding the layering/masking and end up on top of the mask. The script is below, where “sman” is the mask and “sf1” is the movieclip that’s being duplicated. Any help appreciated, thank you!
//import the Tween, Easing classes:
import mx.transitions.Tween;
import mx.transitions.easing.;
stop();
// ----------function to generate a random number
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.round(Math.random()(max-min))+min;
return randomNum;
}
snowman_mc._visible=true;
button2_mc.onRelease = function() {
//make 20 duplicates of sf1_mc and randomly distribute on stage
for (i=1; i<=50; i++) {
duplicateMovieClip(sf1_mc, “sf1”+i, this.getNextHighestDepth()+i);
//duplicateMovieClip(sman_mc, “sman”+i, this.getNextHighestDepth()+j);
//set mask
_root[“sf1”+i].setMask(“sman”+i);
//move them to random x and y
//_root[“sman”+i]._x = 600;
//_root[“sman”+i]._y = 400;
_root[“sf1”+i]._x = randRange(300, 600);
_root[“sf1”+i]._y = randRange(300, 400);
//random scaling x and y to same value
//var newScale = randRange(10, 100);
//_root[“sf1”+i]._xscale = newScale;
//_root[“sf1”+i]._yscale = newScale;
//tween them
//new Tween(_root[“sf1”+i], “_x”, Back.easeIn, _root[“sf1”+i]._x, 30, 1, true);
//new Tween(_root[“sf1”+i], “_y”, Back.easeIn, _root[“sf1”+i]._y, 30, 1, true);
};
}