# Dynamic Masking MovieClips

**URL:** <https://forum.kirupa.com/t/dynamic-masking-movieclips/161152>\
**Category:** flash\
**Created:** [September 1, 2005, 10:02am UTC](https://forum.kirupa.com/t/dynamic-masking-movieclips/161152 "2005-09-01T10:02:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigjr](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@craigjr](https://forum.kirupa.com/u/craigjr)\
**Post date:** [September 1, 2005, 10:02am UTC](https://forum.kirupa.com/t/dynamic-masking-movieclips/161152/1 "2005-09-01T10:02:56Z")

</div>

I have a movieclip in which i create an empty mc and inside there i attach several other mcs in a loop (to create a menu of button movieclips inside the empty one) then I want to create a mask and mask the menu so you only see certain options at a time. So far I have this:

```auto

function createMenu([color=Red]menuIn,....other *params*...[/color]) {

	menuIn.createEmptyMovieClip("menu",1)

	for (i=0; i < menusize; i++){
[color=Black] menuIn.menu.attachMovie(libitem,"menuItem"+buttonCount, buttonCount);[/color]
[color=Red]*[.....code to create buttons from xml info here....]*[/color]
	}
	setMenuMask(menuIn,"dynMenuMask");
}

function setMenuMask(menuIn,maskLibItemIn){
	menuIn.createEmptyMovieClip("menuMaskClip",2);
	menuIn.menuMaskClip.attachMovie(maskLibItemIn,"maskArea",1);
	menuIn.menu.setMask(menuIn.menuMaskClip);
}

```

However the menu (list of mcs dynamically created from library) is not masked, it is created and works but when i run that setMask it doesnt work… is it something to do with depths??

The code I have ommited works, it is just using info from xml to create the list of items. But the list definately gets created and is visible. if i dont use setMask you can see the mask movieclip in position when you use setmask you cant see the mask anymore because its been set to be a mask… but the menu ISN’T being masked by it.

Any Ideas???
