Skip to main content
Inspiring
August 8, 2006
Question

attachMovie under the Mask

  • August 8, 2006
  • 1 reply
  • 228 views
I have a movie in which I have a "Mask arrangement." The arrangement is that I
have a Mask layer with several "cutouts." That layer is masking the layer
below it which has only a single movieclip. I position the movie clip under a
particular cutout so that it shows, then do some other stuff with it. Here's
the trick:

At a certain point, I have that small movieClip execute an attachMovie and
pull another movieClip from the library. I *want* it to be "under the masked
layer" so that this new movieClip also is able to peek out through the holes in
the mask.

However, when I attachMovie the new movieClip appears ON TOP OF the mask
instead of inside being masked. I've tried playing with various layer
management tricks, but it's not working.

I think the issue is that when I add a new movieClip to the stage, it's either
going on a layer BELOW the mask (and the objects it should be masking)...so
don't see it. Or it's going on a layer ABOVE the mask (and the objects it's
masking).

How do I get a new movieClip to appear "inside" the masking arrangment?

---Damian

This topic has been closed for replies.

1 reply

Inspiring
August 8, 2006
Damian,

> How do I get a new movieClip to appear "inside" the
> masking arrangment?

Make sure the mask is also a movie clip, so that you can give it an
instance name. Once named, it gives you convenient access to all the
properties, methods, and events outlined in the MovieClip class. Among the
events is one called setMask(), which, when invoked on a given movie clip
instance, such as the one you loaded, allows you to mask it with another.

If you're pulling from the Library (MovieClip.attachMovie()), you'll be
fine, but if you're loading an external SWF (MovieClip.loadMovie()), you'll
have to make sure the external SWF is fully loaded before you reference any
of its class members.

http://www.quip.net/blog/2006/flash/how-to-tell-when-external-swf-loaded


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."