2011-05-16 54 views
0

我想用按鈕跳轉到框架標籤。他們跳到標籤上很好,但再次按下時不會停下來。下面是我用來讓按鈕再次按下時休息的代碼。保持放在框架標籤上

getting_btn.addEventListener(MouseEvent.CLICK, gettingStarted); 

function gettingStarted(evt:MouseEvent):void { 
gotoAndPlay("ipad_in"); 
if (this.currentLabel == "ipad_rest"){ 
this.gotoAndStop("ipad_rest"); 
} 
} 
+0

不知道我明白你想要做什麼。在第一次點擊時,您希望它轉到標有「ipad_in」的幀,如果它已經在幀「ipad_in」上,然後轉到幀「ipad_rest」,則第二次點擊。這是你正在尋找的結果嗎? – 2011-05-16 20:48:14

+0

是的,我明白了。 Duh不得不翻動它們,所以它首先檢查標籤,然後去正確的幀標籤。 函數getsStarted(evt:MouseEvent):void if(this.currentLabel ==「ipad_rest」) this.gotoAndStop(「ipad_rest」);其他 gotoAndPlay(「ipad_in」); } – cbeezy 2011-05-16 20:49:46

回答

0

杜赫不得不觸發他們,所以它首先檢查標籤,然後去所需的幀標籤。

function gettingStarted(evt:MouseEvent):void 
{ 
    if (this.currentLabel == "ipad_rest") 
     this.gotoAndStop("ipad_rest"); 
    else 
     gotoAndPlay("ipad_in"); 
} 
0

在下一行上您是「ipad_rest」,但上線測試框架名稱您設置幀之前「ipad_in」所以在效果的currentLabel將永遠是「ipad_rest」

gotoAndPlay("ipad_in"); 
if (this.currentLabel == "ipad_rest"){// will never be true 

未經測試,但這應該是關於你想要的全部取決於如果「ipad_in」仍然是活動幀。你的描述很模糊。

function gettingStarted(evt:MouseEvent):void { 
    if (this.currentLabel == "ipad_in"){ 
    this.gotoAndStop("ipad_rest"); 
    }else{ 
    gotoAndPlay("ipad_in"); 
    } 
}