2011-05-16 52 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"); 
    } 
}