以下脚本生成雪花:
for (i = 0; i < 1000; i++)
{
var t:MovieClip = snow_mc.duplicateMovieClip("snow" + i, i);
t._x = random(750);
t._y = random(550);
t._xscale = t._yscale = random(80) + 20;
t.gotoAndPlay(Math.round(random(81) + 1));
}
我希望雪花出现在实例名称为mask_mc的掩码下:
_root.setMask(mask_mc);
但是我的面具削减了我的所有图层和背景图像。我希望它只能切割我的雪花。
答案 0 :(得分:0)
您不得将面具应用于_root
,而是应用于将会创建雪的empty MovieClip
(AS Linkage Snow):
var box:MovieClip = this.createEmptyMovieClip("box", 0);
var t:MovieClip;
for (var i:Number = 0; i < 1000; i++)
{
t = box.attachMovie("Snow", "snow", i);
t._x = Math.random() * 750;
t._y = Math.random() * 550;
t._xscale = t._yscale = Math.random() * 80 + 20;
t.gotoAndPlay(Math.round(Math.random() * 81 + 1));
}
box.setMask(mask_mc);