# Dynamic Masking : loadMovieNum

**URL:** <https://forum.kirupa.com/t/dynamic-masking-loadmovienum/160440>\
**Category:** flash\
**Created:** [August 25, 2005, 11:08pm UTC](https://forum.kirupa.com/t/dynamic-masking-loadmovienum/160440 "2005-08-25T23:08:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hkammer](https://avatars.discourse-cdn.com/v4/letter/h/73ab20/32.png) [@hkammer](https://forum.kirupa.com/u/hkammer)\
**Post date:** [August 25, 2005, 11:08pm UTC](https://forum.kirupa.com/t/dynamic-masking-loadmovienum/160440/1 "2005-08-25T23:08:52Z")

</div>

Hi.

I’m working on a presentation that will consecutively load external SWFs into the \_root of the main SWF and then mask them with a setMask option.

The code I’m using detects the end of the current SWF and then triggers the next SWF to load.

The problem: The code is dependent on loadMovieNum which allows attachment of a SWF to a certain _level_, which nullifies the use of setMask.  
Using loadMovie allows me to use setMask, but that ruins the detection of the end of each SWF.

Here’s the faulty code I’m using with loadMovieNum, nested within an empty movieclip on \_root:

onClipEvent (enterFrame) {  
if (counter == null) {  
\_level2.setMask(\_root.mask);  
loadMovieNum(“lg1.swf”, 2);  
counter = 2;}  
else if ((\_level2.\_totalFrames != undefined) &&  
(\_level2.\_currentFrame == \_level2.\_totalFrames)) {  
filename = “lg” + counter + “.swf”;  
trace (counter);  
loadMovieNum(filename, 2);  
counter++;  
}  
}

All of this to say, is there anyway to set a mask to SWFs loaded with loadMovieNum?

-Kammer
