开发者

Items disappear when setting a mask upon their container

开发者 https://www.devze.com 2023-03-26 08:57 出处:网络
I dinamically build a menu: this menu is made up of two nested MovieClips: externalContainer_mc; itemsContainer_mc (inside externalContainer_mc at 0,0);

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消