2013-08-22 33 views
0

我得到的含有包含滑動按鈕,改變每隔幾秒鐘的影片剪輯一個簡單的閃光燈的場景: enter image description here偶數監聽器添加到時間線上的按鈕是一個影片剪輯的盛大孩子

每一層含有一個按鈕和另一個影片剪輯。 enter image description here

如果我想事件偵聽器添加到舞臺上一個簡單的按鈕,我只是寫:

f4.addEventListener(MouseEvent.CLICK, f4Click); 

function f4Click(event:MouseEvent):void 
{ 
    flash.external.ExternalInterface.call("dlHTCMD", "switchtogame?code=fnf50"); 
} 

,但是當我試圖訪問這兩個影片剪輯裏面的按鈕,像

optContainer.optBeach.btnBeach.addEventListener(MouseEvent.CLICK, btnBeachClick); 

我正在添加一個trace函數來查看事件是否被觸發但什麼都沒有發生。

看起來像一個簡單的問題,但我沒有找到解決方案。

我想過擴展按鈕類,並添加值綁定功能按鈕的名稱,並設置事件監聽器,但我不是一個AS3專家:(

感謝。

回答

0

試試這個:

// Pass mouse events to children 
optContainer.mouseChildren = true; 
optContainer.optBeach.mouseChildren = true; 

// Reset hit area 
optContainer.hitArea = null; 
optContainer.optBeach.hitArea = null; 

// Reset masks 
optContainer.mask= null; 
optContainer.optBeach.mask= null; 

還要檢查是否在每個關鍵幀按鈕有名字

+0

感謝@ marbel82但它不工作 –

+0

多少幀optCo。 ntainer和optContainer.optBeach?你把代碼放在哪裏'optContainer.optBeach.btnBeach.addEventListener(MouseEvent.CLICK,btnBeachClick);'哪個框架? – marbel82

相關問題