# Multiple Mask and Random Image

**URL:** <https://forum.kirupa.com/t/multiple-mask-and-random-image/62102>\
**Category:** flash\
**Created:** [August 25, 2004, 1:06am UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102 "2004-08-25T01:06:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lazyme](https://avatars.discourse-cdn.com/v4/letter/l/5daacb/32.png) [@lazyme](https://forum.kirupa.com/u/lazyme)\
**Post date:** [August 25, 2004, 1:06am UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102/1 "2004-08-25T01:06:49Z")

</div>

I hope someone can give me a hand on this.

I am doing a multiple mask where an image is being masked by multiple little squares that drop down.

I created 2 layers, mask and masked for each square and image.

That part works fine, however, I wanted to load a different image everytime when the page loads, I used the example on this site:

choice = Math.round(Math.random()\*6);  
switch (choice) {  
case 0 :  
location.loadMovie(“image0.swf”);  
break;  
case 1 :  
location.loadMovie(“image1.swf”);  
break;  
…  
}

Now, every little square load a random image instead of all loading the same image. Is it possible to ask all other masked layer to call on that one random image? What should I do?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 1:36am UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102/2 "2004-08-25T01:36:57Z")

</div>

i’m having a hard time understanding what you’re trying to say so if you could post an fla that would help a bit.

are you masking multiple images with multiple squares or squares on separate layers that mask the same image on different layers? not exactly sure what you’re saying…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 6:39am UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102/3 "2004-08-25T06:39:14Z")

</div>

I am doing a multiple masking on one image.

The way I do this multiple masking is by creating 2 layers for each mask: mask and masked layer.

I also want to generate a random masked image everytime it loads.

With the code I used above, each masking layer (mask and masked), I inserted the code for the masked layer. So, the effect I want is a multiple mask on a random image.

But the result is random image for each mask with the current setup.

But I want each mask to call the same random image.

How do I achieve that?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2004, 8:34pm UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102/4 "2004-08-25T20:34:47Z")

</div>

Another way of saying this is, can all masked layers call to one random image?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2004, 8:09pm UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102/5 "2004-08-26T20:09:54Z")

</div>

Wow, this must be harder than I though…no one can help me?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2004, 8:20pm UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102/6 "2004-08-26T20:20:17Z")

</div>

> [@lazyme](#):
>
> Wow, this must be harder than I though…no one can help me?

Think you would be better using movieclips and setMask()  
mc.setMask(mask\_mc)  
to remove  
mc.setMask(null)

put all your little squares into 1 mc

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2004, 10:03pm UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102/7 "2004-08-26T22:03:16Z")

</div>

First of all, thanks for your help. However, I am a ameture in Flash, all I know is doing little animations. Do you mind telling me more about what you just posted?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2004, 11:44am UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102/8 "2004-08-28T11:44:37Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2004, 4:38pm UTC](https://forum.kirupa.com/t/multiple-mask-and-random-image/62102/9 "2004-08-28T16:38:14Z")

</div>

> [@lazyme](#):
>
> Anyone?

if you search these forums, there are tons of examples of masking with script but you really need to look up setMask() and get the basics.
