2011-01-13 111 views
0

O.K,这是一个新的,我碰到了一堵砖墙,我在Flash CS5中使用AS3。我只想做一个补间动画,它停在一个框架上,并有一个可点击的按钮来访问maintime行的另一部分。还有一个动画按钮可以跳过它。一个人如何设置?显然你需要一个stop();在时间线的停止帧处,两个按钮的事件监听器和函数是否正确?除此之外还有更多的帮助。我有这样的设置;导航时间轴

totalSlides:Number = 60; 
currentSlideNumber:Number = 1; 

skipbutton.addEventListener(MouseEvent.CLICK,skipbuttonPress); 

function skipbuttonPress(evt:MouseEvent):void{ 
    currentframelabel = currentframelabel+1; 
    if(currentSlideNumber>=0){ 
     currentframelabel = introstop; 
    } 
    framelabel.gotoAndStop(introstop); 
} 

和框架停止上设置如下

stop(); 

totalSlides:Number = 60; 
currentSlideNumber:Number = 5; 

click01.addEventListener(MouseEvent.CLICK,click01Press); 

function click01Press(evt : MouseEvent) : void { 
    currentSlideNumber = currentSlideNumber+1; 
    if (currentSlideNumber >= 0) { 
     currentSlideNumber = 25; 
    } 
    framelabel.gotoAndStop(mainpage); 
} 

因为我需要这一个项目,任何帮助将受到十分重视。

非常感谢

+0

所以你想要做的是在点击按钮前跳过一帧? – 2011-01-13 17:59:44

回答

0
  1. Framelabels都是字符串,所以应该是 “introstop” 等等。
  2. currentFrameLabel返回当前帧的帧标签的实际名称,而不是当前帧号。所以你不能做currentFrameLabel+1
  3. 如果您只是想跳过一个框架,请执行gotoAndPlay (currentFrame+1);,但通常最好不要使用框架编号,而是使用标签。这样,您可以在标签之间添加或删除框架,而无需重新编程所有内容。我假设你知道如何设置这些。 ;)
  4. frameLabels真的不会去任何地方,MovieClip会。 ;)使用this.gotoAndStop("introstop");或简单地gotoAndStop("introstop");

现在进行设置。在出现的跳过按钮的框架,这样做:

skipbutton.addEventListener(MouseEvent.CLICK,skipbuttonPress); 

function skipbuttonPress(evt:MouseEvent):void{ 
    gotoAndStop("introstop"); 
} 

(除非你有其他用处的slideNumber数 - 你不需要它跳过)

stop();在框架动画的结尾必须有“introstop”标签。

在同一个“introstop”框架上,您需要在舞台上使用click01按钮。然后执行此操作:

stop(); 

click01.addEventListener(MouseEvent.CLICK,click01Press); 

function click01Press(evt : MouseEvent) : void { 
    gotoAndStop("mainpage"); 
} 

其中,“mainpage”必须是要在介绍之后跳转到的帧上的标签。