0
我在獲取語法時遇到了一些問題。刪除事件監聽器並將影片剪輯移動到位置
我有一個影片剪輯,它在觸摸其他影片剪輯時向數組添加聲音。 我有一個停止按鈕比我想刪除酒吧的事件監聽器,併發回到原來的位置。
我的代碼是:
//event listener for the start button
playy.addEventListener(MouseEvent.CLICK, mouseClick2);
function mouseClick2(event:MouseEvent):void
{
bar.addEventListener(Event.ENTER_FRAME, onEnter);
}
//Add event listener for the stop button
stopp.addEventListener(MouseEvent.CLICK, mouseClick3);
//when clicked remove listener send back to position
function mouseClick3(event:MouseEvent):void
{
bar.removeEventListener(MouseEvent.CLICK, mouseClick3);
function mouseClick3(evt:Event):void
{
if(bar.x > 780)
{
bar.x = 215;
}
}
}
function onEnter(evt:Event):void
{
bar.x += 1;
if(bar.x > 780)
{
bar.x = 215;
}
for(var i:int=0; i<blocks.length;i++)
{
if (bar.hitTestObject(blocks[i]))
{
blocks[i].start();
}
else
{
blocks[i].stopSound();
}
}
}
您遇到的一個問題是'function mouseClick3()'嵌套在另一個'function mouseClick3()'函數中。 – Marty 2012-03-29 22:39:17