2017-10-28 172 views
0

我有一個影片剪輯上的CLICK事件監聽器。由於舞臺的佈置方式,在影片剪輯背後製作透明的監聽器非常困難。當你點擊其他任何地方而不是聽者時,是否有辦法運行一個函數?Actionscript 3:當鼠標按下時,運行函數,除了監聽器以外的其他地方?

fash.addEventListener(MouseEvent.CLICK, fashRun); 
+0

訂閱階段** ** MouseEvent.CLICK所以你會得到所有的點擊和檢查,如果鼠標內部或者您想用的任何區域外** DisplayObject.hitTestPoint (...)**作爲條件:https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#hitTestPoint() – Organis

+0

謝謝。我會試試這個 –

+0

無論是前面(阻塞)的目標都可以通過像'blocker.mouseChildren = false;'和'blocker.mouseEnabled = false;'這樣的命令讓鼠標看不見......'嘗試使用相同的命令阻滯劑。 –

回答

0

this API

stage.addEventListener(MouseEvent.CLICK, onClick); 
function onClick(e:MouseEvent):void 
{ 
    if (!fash.hitTestPoint(stage.mouseX, stage.mouseY, true)) 
    { 
    //todo 
    } 
}