Flash AS3制作带影片剪辑的面具

时间:2016-03-27 07:58:31

标签: actionscript-3 flash mask movieclip masking

我想将遮罩效果应用到影片剪辑中。

我制作了一个分为3个区域的影片剪辑。

parent movie clip name is "box"

1 area name(Child box) = "m0" as MovieClip
2 area name(Child box) = "m1" as MovieClip
3 area name(Child box) = "m2" as MovieClip

我已将图像文件转换为名为“pic ..”的影片剪辑

1 photo file(Located at Stage) = "pic0" as MovieClip
2 photo file(Located at Stage) = "pic1" as MovieClip
3 photo file(Located at Stage) = "pic2" as MovieClip

我想动态应用屏蔽效果。

我不知道这个, 你可以稍微提一下建议吗?

var btn:MovieClip = this["btn"] as MovieClip;
btn.addEventListener(MouseEvent.CLICK, goon);

function goon(Event:MouseEvent):void{
    var pic0:MovieClip = this["pic0"] as MovieClip;
    var pic1:MovieClip = this["pic1"] as MovieClip;
    var pic2:MovieClip = this["pic2"] as MovieClip;
    var box:MovieClip = this["box"] as MovieClip;
    trace(box.m0.x + " , " + box.m0.y);

    //box.addChild(mc0);
    box["m0"].mask = box["m0"];
    box["m0"].addChild(pic0);
    pic0.x = 0;
    pic0.y = 0;

}

然而它根本不起作用。 我想知道我需要在我的代码中添加子方法吗? 我该怎么办?

0 个答案:

没有答案