目的:当主场景上只有1帧时,如何用AS来实现用按钮来控制影片的播放。
特别说明:
①:按钮的制作
②:初级AS
制作步骤:
1、打开Flash,并新建一文档,适当修改文档属性。
2、新建一按钮符号,命名为“按钮”,并制作一按钮。
3、新建一
电影符号,命名为“电影”,在此MC中随便做个动画。(图1)
![]()
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';} onclick=if(!this.resized) {return true;} else {window.open('/Multimedia/UploadFiles_3360/200612/20061229001146955.jpg');} alt= src=http://www.flashdongman.com/Multimedia/UploadFiles_3360/200612/20061229001146955.jpg onload=if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';} border=0>
4、将“按钮”与“电影”分别拖入到主场景中。(图2)
![]()
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';} onclick=if(!this.resized) {return true;} else {window.open('/Multimedia/UploadFiles_3360/200612/20061229001146535.jpg');} alt= src=http://www.flashdongman.com/Multimedia/UploadFiles_3360/200612/20061229001146535.jpg onload=if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';} border=0>
5、回到“电影”中,在其第一帧中
加入AS语句:stop()。(图3)
![]()
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';} onclick=if(!this.resized) {return true;} else {window.open('/Multimedia/UploadFiles_3360/200612/20061229001147626.jpg');} alt= src=http://www.flashdongman.com/Multimedia/UploadFiles_3360/200612/20061229001147626.jpg onload=if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';} border=0>
6、回到主场景中,在‘电影’的属性面板中,为其命名为“MC”。(图4)
![]()
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';} onclick=if(!this.resized) {return true;} else {window.open('/Multimedia/UploadFiles_3360/200612/20061229001147974.jpg');} alt= src=http://www.flashdongman.com/Multimedia/UploadFiles_3360/200612/20061229001147974.jpg onload=if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';} border=0>
7、在‘按钮’中加入如下AS语句:
on (release) {
MC.play()
}
上面的AS意义为:当鼠标按下按钮时,MC(就是第6步命名的MC的‘电影’了)开始播放。
8、Ctrl+回车测试一下吧。