1

I want to apply mask effect into movie clip.

I made a movie clip that was divided 3 areas.

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

I've converted image file to movie clip named "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

I'd like to apply masking effect dynamically.

I have no idea of this, Can you give an advice a little bit?

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;

}

However it's not working at all. And I'm wondering do I need add child methods in my code? What should i do?

Richard
  • 351
  • 4
  • 17
  • you need to be much more clear in what you want. Can you add some images? – Jezzamon Mar 27 '16 at 10:13
  • No, there are 3 images in the stage. I'd like to know how to adjust mask effect with one movie clip. – Richard Mar 27 '16 at 10:17
  • What I meant is can you add some images into your question here to explain what you're trying to do. It's hard to tell. For example, I can't tell what you want to use as the mask and what thing you want to mask. – Jezzamon Mar 27 '16 at 10:20
  • @Richard Try this for example : `pic0.mask = box.m0; pic1.mask = box.m1; pic2.mask = box.m2;` ... – akmozo Mar 27 '16 at 11:50
  • @akmozo That's how you do it :) Thank you very much~ – Richard Mar 27 '16 at 13:59
  • @Jezzamon I got it. I'll do better next time. Thank you – Richard Mar 27 '16 at 14:00

0 Answers0