1
在有生命的CC,(動作3)我有需要按順序去當「A」或「d」按鈕被按下等,從而4個幀:的Actionscript導航不工作
(((((1- - > 2 - > 3 - > 4 |||然後返回||| 4 - > 3 - > 2 - > 1)))))
這工作正常,但當我回到第1幀後上述順序,點擊下一個將我所有的幀4的方式(使用跟蹤我確定所有的事件監聽器觸發的,我不知道爲什麼)
下面是每一幀代碼:
1幀
stage.addEventListener(KeyboardEvent.KEY_DOWN, nextFram);
function nextFram(e:KeyboardEvent):void{
if (currentLabel == "home" && e.keyCode == Keyboard.D){
\t trace("gotobuttonpage");
\t gotoAndPlay("buttonPage");
\t removeEventListener(KeyboardEvent.KEY_DOWN, nextFram);
\t trace("event listener removed");
\t
}
}
stop();
幀2
stage.addEventListener(KeyboardEvent.KEY_DOWN, nextFram2);
function nextFram2(e:KeyboardEvent):void{
if (currentLabel == "buttonPage" && e.keyCode == Keyboard.D){
\t trace("gotovideopage");
\t gotoAndPlay("videoPage");
\t removeEventListener(KeyboardEvent.KEY_DOWN, nextFram2);
\t trace("event listener removed");
\t
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, backFram2);
function backFram2(e:KeyboardEvent):void{
if (currentLabel == "buttonPage" && e.keyCode == Keyboard.A){
\t trace("backtohomepage");
\t gotoAndPlay("home");
\t removeEventListener(KeyboardEvent.KEY_DOWN, backFram2);
\t trace("event listener removed");
\t
}
}
stop();
幀3
stage.addEventListener(KeyboardEvent.KEY_DOWN, nextFram3);
function nextFram3(e:KeyboardEvent):void{
if (currentLabel == "videoPage" && e.keyCode == Keyboard.D){
\t trace("gotoendpage");
\t gotoAndPlay("endPage");
\t removeEventListener(KeyboardEvent.KEY_DOWN, nextFram3);
\t trace("event listener removed");
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, backFram3);
function backFram3(e:KeyboardEvent):void{
if (currentLabel == "videoPage" && e.keyCode == Keyboard.A){
\t trace("gotobuttonpage!");
\t gotoAndPlay("buttonPage");
\t removeEventListener(KeyboardEvent.KEY_DOWN, backFram3);
\t trace("event listener removed");
}
}
stop();
幀4
stage.addEventListener(KeyboardEvent.KEY_DOWN, backFram4);
function backFram4(e:KeyboardEvent):void{
if (currentLabel == "endPage" && e.keyCode == Keyboard.A){
\t trace("backtovideopage");
\t gotoAndPlay("videoPage");
\t removeEventListener(KeyboardEvent.KEY_DOWN, backFram4);
\t trace("event listener removed");
\t
}
}
stop();
我使用prevFrame也嘗試();和nextFrame();但同樣的問題導致我相信我的順序邏輯是正確的,但我的事件聽衆是問題,請有人可以爲我闡明這一點。