2011-08-11 27 views
0

我已經做出了一個動作腳本3代碼來獲取圖像,做一個addchild做它,並添加一個面具。Flash AS3如何去除遮罩上的重疊孔?

一切工作正常,除了我做的面具是一個動畫的MovieClip,並且這個MovieClip隱藏了一些點,其中該MovieClip內的2個或更多對象彼此重疊。 我還沒有找到如何去除這個效果,所以這個面具在重疊時也是有效的。

所以基本上我需要知道如何禁用AS3中的重疊排除效應。有沒有解決這個問題的設置?

代碼在這裏:

// area is a MovieClip 
// images_loaded[current_int] is a loaded image 
// slider is a MovieClip, which I use to mask with 
next_image   = area.addChild(images_loaded[current_int]); 
next_image.x  = 0; 
next_image.y  = 0; 
var masky:MovieClip = new slider; 
masky.x    = 0; 
masky.y    = 0; 
area.addChild(masky); 
next_image.mask = masky; 

謝謝!

編輯:

這裏的問題:

Example

滑塊,影片剪輯了7層。第一層是字母M,第七層是大框。基本上,我首先要先用字母填滿面膜,然後用bix盒蓋住整個面膜。但是,當這兩個覆蓋,你可以灰色的結果(這是背景)。 我希望它能夠顯示整個圖片,而不會產生這種重疊效果。

+0

這是一個有點難以理解的問題是什麼,沒有看到影片剪輯。你可以發佈一個屏幕抓取問題(也可能是面具,也可能是你想要它應該看起來像)? –

+0

我已添加更多信息。 –

回答

0

屏蔽肯定可以在Flash是一個謎。

我之前解決了這個問題,而是將所有內容都打包到一個圖層中。然後沒有可能相互重疊的層。

This article和一些the comments包含非常好的解決方案怪異的掩膜行爲。希望他們會幫助你!

一個soluton這始終是值得嘗試是cacheAsBitmap = true

1

這是由flash.display.GraphicsPathWinding

,如果你製作你的顯卡,無論是GraphicsPath類或drawPath()功能引起的,只需分配相應的值到winding參數。如果您使用繪圖易用性方法(IE:drawRect)在面具Sprite中生成圖形,則可以通過將每個平局打包爲beginFill()endFill()來避免纏繞問題。

因此,而不是寫這個:

s.graphics.beginFill(0xFF0000, 1.0); 
s.graphics.drawRect(0, 0, 100, 100); 
s.graphics.drawRect(20, 20, 100, 100); 
s.graphics.drawRect(40, 40, 100, 100); 
s.graphics.endFill(); 

enter image description here

這樣寫:

s.graphics.beginFill(0xFF0000, 1.0); 
s.graphics.drawRect(0, 0, 100, 100); 
s.graphics.endFill(); 
s.graphics.beginFill(0xFF0000, 1.0); 
s.graphics.drawRect(20, 20, 100, 100); 
s.graphics.endFill(); 
s.graphics.beginFill(0xFF0000, 1.0); 
s.graphics.drawRect(40, 40, 100, 100); 
s.graphics.endFill(); 

enter image description here

+0

這提醒了我很多我的問題,但是我有一個準備好的動畫片段和一切都會得到這種效果的影片剪輯,我可能無法放置endFill()。是否有某種設置可以禁用此功能? –