# Help with setMask

**URL:** https://forum.kirupa.com/t/help-with-setmask/172780
**Category:** flash
**Created:** [December 17, 2005, 10:06pm UTC](https://forum.kirupa.com/t/help-with-setmask/172780 "2005-12-17T22:06:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![RoboLlama](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@RoboLlama](https://forum.kirupa.com/u/RoboLlama)
#### Post date: [December 17, 2005, 10:06pm UTC](https://forum.kirupa.com/t/help-with-setmask/172780/1 "2005-12-17T22:06:30Z")

</div>

Essentially, I am trying to fill a graphic with a pattern, which is loaded externally via XML.

This is my code (it doesn’t work):

[AS] selectedGraphic = \_root[“container” + (selection-1)];

```
patternToBeMasked = _root.createEmptyMovieClip("pattern" + (selection-1), getNextAvailableLevel());
patternToBeMasked.loadMovie(fileName);

patternToBeMasked.setMask(selectedGraphic);[/AS]

```

The graphics are loading properly, but the setMask command seems to have no effect. Is there something else I should be doing? Is setMask sensitive to levels or how movieclips are nested within each other?
