# Please review how I want to do masking

**URL:** <https://forum.kirupa.com/t/please-review-how-i-want-to-do-masking/324223>\
**Category:** flash\
**Created:** [August 9, 2011, 11:25am UTC](https://forum.kirupa.com/t/please-review-how-i-want-to-do-masking/324223 "2011-08-09T11:25:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg767](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@Greg767](https://forum.kirupa.com/u/Greg767)\
**Post date:** [August 9, 2011, 11:25am UTC](https://forum.kirupa.com/t/please-review-how-i-want-to-do-masking/324223/1 "2011-08-09T11:25:12Z")

</div>

Hi,

I can’t try this at the moment, but I would like to know if this is the way to do it.

So here is the scenario:

I am developing a standalone app that is composed of modules.  
A module is a sprite container that contains other sprites or movieclips. Pure AS3, design was made with the IDE and exported as SWF.

In one module, I have a curved background that is loaded from an SWF.  
On this curved background I have other modules loaded that are displayed with an alpha tween and they are fully on the background, they don’t move.  
But I have two modules that have a rectangle base bigger than the height of the curved background and I want to motion tween them on the curved background in a way that the parts hanging off the curved background are masked.

So the Z order and hierarchy would be like this:

------ sprite container parent  
[LIST]  
[_]curved background  
[_]module 1 (staying inside background)  
[_]module 2 (inside)  
[_]module … (inside)  
[_]bigger rectangle module that need to be masked and motion tweened in  
[/LIST]My solution would be:  
[LIST]  
[_]load another instance of the curved background to use it as a mask.  
[_]add this mask to the display list as a child of the “sprite container parent”  
[_]keep this mask on the top of all modules(??? not sure about this)  
[_]position the mask exactly as the curved background  
[_]load the module that I want to mask and position it outside of the visible stage  
[_]add the mask on the module that need to be masked.  
[_]motion tween the module to the visible area  
[/LIST]  
What I am not sure about:  
[LIST]  
[_]even if the mask is not child the module to be masked, will it move with the module that is tweened? (I want the mask to stay still)  
[_]I want every other display object to be visible under the mask, only the masked module should be masked (this is obvious I guess)  
[/LIST]  
Thanks a lot for helping me out with this!  
Greg
