首页 > 代码库 > 使用as3控制动画的播放与暂停

使用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