为什么setMask工作在它工作一次之后才是这个例子

时间:2022-06-25 18:54:56

I'm trying to use setMask to create 3 "windows" of masked movieClips in AS2 (CS3).

我正在尝试使用setMask在AS2(CS3)中创建蒙版movieClip的3个“窗口”。

The main window is masked fine.

主窗口被遮盖好了。

After clicking a button, I'm creating two additional windows, but the refuse to be masked No error, it's just that the mask is not applied, and the mask rectangle is still visible.

单击一个按钮后,我创建了两个额外的窗口,但是拒绝被屏蔽没有错误,只是没有应用蒙版,并且蒙版矩形仍然可见。

All 3 windows are masked using the same function, with different MC parameter.

所有3个窗口都使用相同的功能进行屏蔽,具有不同的MC参数。

I have nested MCs, but basically, the main window is masked as:

我有嵌套的MC,但基本上,主窗口被屏蔽为:

_level0.GUI.OBJ.mainWinMC.mainWindowMC.mainWindow.setMask(_level0.GUI.OBJ.mainWinMC.mainWindowMC.mainWindow_PlanMask);

where mainWindow_PlanMask contains an MC with a red rectangle. (Note: I'm using MovieClip variables and I posted here their movieclip traced path. This works fine.

其中mainWindow_PlanMask包含带有红色矩形的MC。 (注意:我正在使用MovieClip变量,我在这里发布了他们的movieclip跟踪路径。这很好用。

After pressing a button, I'm setting two more masks:

按下按钮后,我又设置了两个面具:

_level0.GUI.OBJ.mainWinMC.side0MC.side0.setMask(_level0.GUI.OBJ.mainWinMC.side0MC.side0_PlanMask);

_level0.GUI.OBJ.mainWinMC.side1MC.side1.setMask(_level0.GUI.OBJ.mainWinMC.side1MC.side1_PlanMask);

side0_PlanMask and side1_PlanMask contain rectangles too. But in these cases, the red rectangle is kept visible and the mask is not applied. I have no idea why. Any help will be appreciated.

side0_PlanMask和side1_PlanMask也包含矩形。但在这些情况下,红色矩形保持可见,并且不应用蒙版。我不知道为什么。任何帮助将不胜感激。

[Edit] applying cacheAsBitmap all MCs from both mask and masked MCs to the _root caused the first mask operation not to work as well.

[编辑]将cacheAsBitmap应用于掩码和掩码MC中的所有MC到_root导致第一个掩码操作也不起作用。

2 个解决方案

#1


Masks in Flash can be unpredictable. Try setting cacheAsBitmap to true for everything.

Flash中的掩码可能无法预测。尝试将cacheAsBitmap设置为true。

UPDATE:

Try setting cacheAsBitmap to true for each movieclip going down from the _root. Try Embedding all fonts on any textfields that are inside the movieclip you are masking - infact make sure you have embedded all your fonts everywhere.

尝试将从_root下载的每个动画片段的cacheAsBitmap设置为true。尝试将所有字体嵌入到您正在屏蔽的动画片段内的任何文本字段中 - 事实上确保您已将所有字体嵌入到处。

#2


it's hard to help you debug with the provided information

使用提供的信息很难帮助您进行调试

you can try:

你可以试试:

  1. make sure you have correctly named the movieclips with an incorrect instance names (sometimes you will find that you forgot to name some of the movieclips)

    确保您使用不正确的实例名称正确命名了动画片段(有时您会发现您忘记为某些动画片段命名)

  2. open a new fla and make a much more simple version of the things that you want to do, so that you can isolate the errors.

    打开一个新的fla并制作一个更简单的你想做的事情版本,以便你可以隔离错误。

btw, not really necessary, but try using _root instead of _level0, it will be clearer.

顺便说一句,不是真的有必要,但尝试使用_root而不是_level0,它会更清晰。

#1


Masks in Flash can be unpredictable. Try setting cacheAsBitmap to true for everything.

Flash中的掩码可能无法预测。尝试将cacheAsBitmap设置为true。

UPDATE:

Try setting cacheAsBitmap to true for each movieclip going down from the _root. Try Embedding all fonts on any textfields that are inside the movieclip you are masking - infact make sure you have embedded all your fonts everywhere.

尝试将从_root下载的每个动画片段的cacheAsBitmap设置为true。尝试将所有字体嵌入到您正在屏蔽的动画片段内的任何文本字段中 - 事实上确保您已将所有字体嵌入到处。

#2


it's hard to help you debug with the provided information

使用提供的信息很难帮助您进行调试

you can try:

你可以试试:

  1. make sure you have correctly named the movieclips with an incorrect instance names (sometimes you will find that you forgot to name some of the movieclips)

    确保您使用不正确的实例名称正确命名了动画片段(有时您会发现您忘记为某些动画片段命名)

  2. open a new fla and make a much more simple version of the things that you want to do, so that you can isolate the errors.

    打开一个新的fla并制作一个更简单的你想做的事情版本,以便你可以隔离错误。

btw, not really necessary, but try using _root instead of _level0, it will be clearer.

顺便说一句,不是真的有必要,但尝试使用_root而不是_level0,它会更清晰。