I dinamically build a menu: this menu is made up of two nested MovieClips:
- externalContainer_mc;
- itemsContainer_mc (inside externalContainer_mc at 0,0);
itemsContainer loads a dinamic number of MenuItems: they are library objects (extending the MovieClip class). Anything works just fine, but if, when anything is loaded, I put a mask (itemsContainer_mc.mask=my_mask
) upon itemsContainer, every MenuItem disappea开发者_如何学Pythonrs AND it isn't even clickable anymore. What happens?
Make sure that your mask contains some pixel data, otherwise it will hide everything:
my_mask.beginFill(0x000000);
my_mask.drawRect(0, 0, your_width, your_height);
my_mask.endFill();
If you're adding the mask with code, it is good practice to first set the mask and the maskee to cache as bitmaps.
itemsContainer_mc.cacheAsBitmap = true;
my_mask.cacheAsBitmap = true;
itemsContainer_mc.mask = my_mask;
Create your own mask and export it using a class name, then use it. this will work.
精彩评论