flash_as3.0_常用代码_珍藏版

  • 格式:doc
  • 大小:53.00 KB
  • 文档页数:10

1.全屏播放

fscommand("fullscreen",true);

2.打开时全屏,在该帧停止

fscommand("fullscreen",true);

stop();

3.跳帧播放(从第几针开始播放后)

on (press) {

gotoAndPlay(?);

}

4.点击时开始播放

on (press) {

play();

}

5.退出语句

如果是FLASH自带的控件 on (click){ fscommand("quit",""); }

自已做的按钮 on (release){ fscommand("quit",""); }

6、当鼠标滑过影片剪辑时,停止播放时间轴。

on (rollOver) {

_root.stop();

}

7、 当在影片剪辑上按下鼠标时,停止播放影片剪辑。

on (press) {

stop();

}

8、当影片剪辑上松开鼠标时, 播放影片剪辑。

on (release) {

play();

}

9、当鼠标滑离影片剪辑时,播放当前时间轴。

on (rollOut) {

_root.play();

}

10、Goto:跳到一个指定的帧(Frame)

Scene: 指定 Scene

Frame:Number,Label,Expression,Next Frame,Previous Frame

可以选择 Frame 的编号,标号,通过表达式,下一帧,前一帧

Expression: 定义表达式

Control:Go to and Play,Go to and Stop 通过选择这个项目来确定到达指定的帧以后是继续播放还是停止

例子:

Go to and Play (1) 跳到第一帧播放

Go to Next Frame 跳到下一帧播放

Go to and Stop ("intro") 跳到标号为 intro 的帧播

11、Play:播放

Stop:停止

Toggle High Quality:切换画面的细节程度

Stop All Sounds:停止所有声音

Get URL:打开指定的网址

URL: 网址

Windows:_self,_blank,_parent,_top 打开网址时使用的目标

Variables on’t Send,Send use GET,Send use POST 变量的传递方式

例子:

Get URL ("next.asp", window="_blank", vars=POST) 在新窗口中打开 next.asp,并且传递参数

12、FScommand:调用命令

Command: 命令

Arguments: 参数

For standalone player:fullscreen,allowscale,showmenu,exec,quit

播放器使用的固定命令和参数

例子:

FS Command ("fullscreen", "true") 设置全屏幕播放

13、Load/Unload Movie: 调入/释放外部的影片

Action:Load movie into location,Unload movie from

location,Load variables into location: 可以选择是否调入新影片,释放已经调入的影片,调入变量

URL:影片的网址

Location:Level,Target: 调入的层,或者是某一目标对象的位置

Variables on’t Send,Send use GET,Send use POST: 变量的传递方式

例子:

Load Movie ("test.swf", 1): 把 test.swf 调入到第一层

Load Movie ("test.swf", "loadit", vars=GET): 把 test.swf 调入到

loadit 目标对象的位置

Unload Movie ("loadit"): 把 loadit 目标对象处的影片释放

Load Variables ("makeit.asp", 2, vars=GET): 调用 makeit.asp 并接收返回的变量

14、Tell Target: 指定目标对象

Target: 目标对象

例子:

Begin Tell Target ("obj") 指定目标对象 obj

End Tell Target

15、If Frame is Loaded: 判断某帧是否调入

Scene: 指定场景

Frame:Number,Label,Expression: 指定帧,标号或者表达式

Expression: 表达式

例子:

If Frame Is Loaded (Scene 1, "end")

End Frame Loaded

:判断场景一的标号为 end 的帧是否调入

16、On MouseEvent 鼠标时间响应

Event ress,Release,Release Outside,Roll Over,Roll Out,Drag

Over,Drag Out,Key Press 各种事件:按下,放开,在外面放开,焦点移入,移出,拖过,拖出,按键按下

例子:

On (Press) 鼠标按下的时候

End On

On (Key: s) 键盘上 s 按下的时候

End On

17、If 判断条件是否成立

Condition: 条件

Add Else/Else If clause: 加入 Else 再次判断

例子:

If (a=10) 如果 a=10 那么……

End If

If (a=10) 如果 a=10 那么……不然……

Else

End If

18、Loop 循环

Condition: 条件

例子:

Loop While (a=10) 如果 a=10 那么循环

End Loop

19、Call 调用函数帧或对象

Frame: 函数帧

例子:

Call ("make") 调用 make 帧程序

20、 Set Property 设置属性

Set:Y Positon,X Position,Y Scale,X

Scale,Alpha,Visibility,Rotation,Name,High quality,Show focus

rectangle,Sound buffer time 设置 y 坐标,x坐标,y 放大倍数,x 放大倍数,透明度,可视否,旋转角度,名称,精细度,焦点矩形框是否显示,声音缓冲时间(默认5秒)

Target: 目标对象

value: 值

例子:

Set Property ("aoe", X Position) = "12" 设置目标对象 aoe 的 x 坐标为 12

Set Property (Show focus rectangle) = "0" 取消焦点框

21、Set Variable 设置变量

Variable: 变量

value: 值

例子:

Set Variable: "test" = 10 设置 test=10

22、Duplicate/Remove Movie Clip 复制对象

Action uplicate movie clip,Remove duplicate movie clip 可选择是复制还是删除

Target: 目标对象

New name: 新目标对象的名字

Depth: 深度

例子:

Duplicate Movie Clip ("aoe", "aoe2", 1) 复制 aoe 一个新的动画,名字叫 aoe2

Remove Movie Clip ("aoe2") 删除目标对象 aoe2

23、Drag Movie Clip 拖动影片片段

Start drag operation: 开始拖动

Target: 目标对象

Constrain to rectangle:Left,Top,Right,Bottom 鼠标的位置,左上右下

Lock mouse to center: 鼠标放置在中心

Stop drag operation 停止拖动

例子:

Start Drag ("aoe", L=2, T=3, R=4, B=5) 拖动目标对象 aoe,位置在 L=2, T=3, R=4, B=5

Start Drag ("aoe", lockcenter) 拖动目标对象 aoe,位置在中心

Stop Drag 停止拖动

24、Trace 跟踪

Message: 信息

例子:

Trace ("aoe") 显示 aoe

Trace (aoe) 显示 aoe 的值

25、 Comment 注释

Comment: 注释

例子:

Comment ("计算") 注释:计算

box_btn.onPress=function(){

trace("ok");

};

按钮实例名称.事件处理方法=function(){

//处理程序

};

例如:

n=1

box_btn.onRelease=function(){

n=n+1

trace("n="+n);