下面列出了最常用的事件和消息:
■ m o u s e D o w n—用户点击鼠标键。在Wi n d o w s中,这对应于鼠标的左键。
■ m o u s e U p—用户释放鼠标键。每一个m o u s e U p消息前面都有一个m o u s e D o w n消息,但它们不一定是发给同一个角色的。
■ m o u s e E n t e r—光标进入某个角色的区域。
■ m o u s e L e a v e—光标离开某个角色的区域。
■ m o u s e Wi t h i n—只要光标在角色上,就连续发送该消息,即每帧发送一次。
■ m o u s e U p O u t s i d e—当用户点击某个角色,却又把光标移出,使之离开对象时所发送的消息。
■ b e g i n S p r i t e—在剪辑室内,当播放头首次遇到某角色时所出发的消息。
■ p r e p a r e F r a m e—当新的一帧刚开始、还没有显示在舞台上时所发出的消息。
■ e n t e r F r a m e—当新的一帧刚开始、已经显示在舞台上时所发出的消息。
■ e x i t F r a m e—当影片播放完一帧,准备播放下一帧时所发出的消息。
■ p r e p a r e M o v i e—在显示影片的第一帧之前所发送的消息。
■ s t a r t M o v i e—在刚刚显示影片的第一帧后立即发送的消息。
■ s t o p M o v i e—当影片结束时所发出的消息。
■ i d l e—在影片从播放开始到播放结束的过程中持续不断地发出的消息。发出该消息的
次数取决于节奏有多慢和计算机的速度有多快。
■ k e y D o w n—当用户按下键盘上的某个键时所发出的消息。
■ k e y U p—当用户释放键盘上的某个键时所发出的消息。
数字运算:+ - * /
函数:f l o a t 把数字转换为浮点数float(4) = 4.000
i n t e g e r 用四舍五入法把浮点数变成整数。对整数使用该函数,整数将保持原状 integer(7.8) = 8
m o d 用来把数字在一个范围内。该值总是从0起,到这个指定的数字 4 mod 3 = 1
字符串变量:
Random(X)取0-X之间的随机数
连接字符串的方法是使用“&”字符,“ & &”用一个空格连接两个字符串
比较变量
= 两个数字是否相等? 两个字符串是否相同?
< 第一个数字是否小于第二个数字? 如果按字母顺序排列,第一个字符串是否排在第二个字符串的前面?
> 第一个数字是否大于第二个数字? 如果按字母顺序排列,第一个字符串是否排在第二个字符串的后面?
< = 第一个数字是否小于或等于第二个数字? 如果按字母顺序排列,第一个字符串是否排在第二个字符串的前面,或与之完全相同?
> = 第一个数字是否大于或等于第二个数字? 如果按字母顺序排列,第一个字符串是否排在第二个字符串的后面,或与之完全相同?
< > 第一个数字与第二个数字是否不同?换句话说,它们不相等吗?两个字符串是否不同?
Lingo的浏览命令
go to frame X 影片走到编号为X的那一帧go to frame 7
go to frame "X" 影片走到标志为X的那一帧go to frame "c r e d i t s"
go to the frame 影片重复播放同一帧go to the frame
go to the frame + X 影片向前跳X帧go to the frame + 1
go to the frame - X 影片向后跳X帧go to the frame - 1
go next 影片跳到下一个带有标志的帧go next
go previous 影片跳到当前带标志的帧的前面一个带有标志的帧go previous
go loop 影片跳回当前带标志的帧go loop
go marker(X) 影片向前跳到第X个带有标志的帧go marker(2)
go marker(-X) 影片向后跳到第X个带有标志的帧Go marker(-2)
控制角色的属性
位置信息:loc坐标信息;l o c H角色的横向位置,l o c V纵向位置,p o i n t ( x , y)横向和纵向位置
i n k 角色的油墨
0 C o p y
1 Tr a n s p a r e n t
9 M a s k
3 2 B l e n d
3 6 Background Tr a n s p a r e n t
常用:Sprite(1).ink=36
b l e n d 角色的混色1 0 0
t r a i l s 轨迹属性是开还是关TRUE/FA L S E
set the trails of sprite 2 to 1
sprite(2).trails=1
c o l o r 角色的前景色
角色的背景色bgcolor
文本演员的前景色和背景色:f o r e C o l o r和b a c k C o l o r:
set the forecolor of member "text" to 40
set the backcolor of member "text" to 160
rg b ("# 0 0 0 0 0 0"),rgb(0,0,255),paletteIndex(35)
visible 可见属性visible=false/true
rotation角色的角度
skew 角色的扭曲
fillcolor,endcolor矢量演员的填充颜色和笔触颜色:member(“circle”).fillcolor=36
鼠标位置:the mouseh ; the mouseV
Scale 角色的缩放
the date,the long time 系统日期和时间
flipH,flipV角色的水平翻转,垂直翻转(值为true/false)
moveableSprite 角色的可移动,值为true/false , 0/1
鼠标形态 cursor X
■ 0—返回至系统的缺省光标。
■ - 1—箭头光标。
■ 1—I形光标。
■ 2—细十字线。
■ 3—粗十字线。
■ 4—钟表光标。
■ 2 0 0—空白光标。
260--手掌
■ 2 8 0—手指光标。
主要命令:
替换演员:sprite(1).member=member(“X”) (X为member的name属性) 或者 sprite(1).member=member X(member的#号属性)
替换域文本内容:member(“X”).text=” XXXXXXXX ”
播放/停止swf动画:play/stop sprite(X)
mask演员获得舞台中的坐标位置:member("mask").regpoint=point(x,y)
soundBusy(X) 声音通道忙函数,值为true/false
导入声音文件播放:puppetsound 1,"mm"
声音的播放和暂停:Sound(1).pause();sound(1).play()
设置文本的字体:set the font of member 1 to "arial black"
设置文本的字体大小:set the fontsize of member 1 to 24
设置文本的样式:member(1).fontstyle=[#bold,#underline]
主要语法结构:
If结构
If 条件1 and/or 条件2 then
―――
Else
―――
End if
Property count
On beginsprite
count=0
end
On mousedown
count=count+1
if count<120 then
go to the frame
else
go to the frame+5
count=0
end if
end
Repeat循环结构:
on wait
repeat with n=1 to 100000
nothing
end repeat
repeat while the mousedown
sprite(1).loc=the mouse
updatestage
end repeat
Case结构:
case (the key) of
"a": Sprite (1). forecolor = 35
"b": Sprite (1). forecolor = 135
,"r":"font-family:宋体;font-size:14px Sprite (1). forecolor = 235
otherwise
Sprite (1). forecolor = 335
end case