# Array elements and setMask() ? hekp please

**URL:** <https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383>\
**Category:** Uncategorized\
**Created:** [August 9, 2004, 1:27pm UTC](https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383 "2004-08-09T13:27:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mx\_guest2004](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@mx\_guest2004](https://forum.kirupa.com/u/mx_guest2004)\
**Post date:** [August 9, 2004, 1:27pm UTC](https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383/1 "2004-08-09T13:27:55Z")

</div>

Hi,  
I have duplicated a few bars and placed them on a MC (an image), trying to define each of these bars as a mask of the same MC. But it seems that only the last element of the array works as a mask. Can we define 10 bars to be a mask of the same MC?  
[AS]  
var bars = new Array();  
var n = 10;  
var num=0;  
gridx = bar.\_width;

for(i=0;i\<n;i++){  
\_root.bar.duplicateMovieClip(“bar”+num,num);  
mc = this[“bar”+num];  
mc.lag = num;  
mc.\_x=gridx\*i;  
mc.\_y=-320;  
bars[num] = mc;  
pic.setMask(bars[num]);  
num++;  
}  
[/AS]

any help on this, please?  
mx-guest2004

---

<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 9, 2004, 2:02pm UTC](https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383/2 "2004-08-09T14:02:27Z")

</div>

> [@mx-guest2004](#):
>
> Hi,  
> I have duplicated a few bars and placed them on a MC (an image), trying to define each of these bars as a mask of the same MC. But it seems that only the last element of the array works as a mask. Can we define 10 bars to be a mask of the same MC?  
> [AS]  
> var bars = new Array();  
> var n = 10;  
> var num=0;  
> gridx = bar.\_width;
> 
> for(i=0;i\<n;i++){  
> \_root.bar.duplicateMovieClip(“bar”+num,num);  
> mc = this[“bar”+num];  
> mc.lag = num;  
> mc.\_x=gridx\*i;  
> mc.\_y=-320;  
> bars[num] = mc;  
> pic.setMask(bars[num]);  
> num++;  
> }  
> [/AS]
> 
> any help on this, please?  
> mx-guest2004

Put all your bars into a mc and use that to mask.

---

<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 9, 2004, 3:04pm UTC](https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383/3 "2004-08-09T15:04:33Z")

</div>

You know, I want to make these bars comming down after each other with a time lag.  
mx-guest2004

---

<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 9, 2004, 4:18pm UTC](https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383/4 "2004-08-09T16:18:56Z")

</div>

> [@mx-guest2004](#):
>
> You know, I want to make these bars comming down after each other with a time lag.  
> mx-guest2004

you still can  
[http://www.kirupaforum.com/forums/showthread.php?t=65011](http://www.kirupaforum.com/forums/showthread.php?t=65011)

---

<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 9, 2004, 5:11pm UTC](https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383/5 "2004-08-09T17:11:28Z")

</div>

Does the image become masked with this effect? I mean when the different bars come down at different times, does the different parts of the image appear under the mask?  
You know, I don’t have my .fla file here right now, therefore have to ask these questions.  
mx-guest2004

---

<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 9, 2004, 5:21pm UTC](https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383/6 "2004-08-09T17:21:12Z")

</div>

> [@mx-guest2004](#):
>
> Does the image become masked with this effect? I mean when the different bars come down at different times, does the different parts of the image appear under the mask?  
> You know, I don’t have my .fla file here right now, therefore have to ask these questions.  
> mx-guest2004

Yes they do, have you had a look at the files in the other post?

---

<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 9, 2004, 6:17pm UTC](https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383/7 "2004-08-09T18:17:45Z")

</div>

Ok I get it now. Thanks stringy 🙂  
mx-guest2004

---

<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 9, 2004, 6:43pm UTC](https://forum.kirupa.com/t/array-elements-and-setmask-hekp-please/60383/8 "2004-08-09T18:43:46Z")

</div>

> [@mx-guest2004](#):
>
> Ok I get it now. Thanks stringy 🙂  
> mx-guest2004

welcome
