使用as3控制动画的播放与暂停

1.需要两个按钮元件

2.在属性面板为两个按钮元件分别命名为pausebutton与playButton

3.代码

stop();

pausebutton.visible = false;
playButton.visible = true;
function startMovie(event:MouseEvent):void 
{ 
    this.play(); 

    playButton.visible = false;
    pausebutton.visible = true;


    
}
function stopMovie(event:MouseEvent):void 
{ 
    this.stop(); 

    playButton.visible = true;
    pausebutton.visible = false;


    
}
playButton.addEventListener(MouseEvent.CLICK, startMovie);
pausebutton.addEventListener(MouseEvent.CLICK, stopMovie);
View Code

 

posted on 2014-07-15 00:52  左小兵  阅读(258)  评论(0编辑  收藏  举报

导航