“在舞台范围内按鼠标右键观看效果!”
end startMovie
--显示菜单事件
on ShowMenu
--打开通道2至12,显示菜单和菜单选择棒(由于选择棒的透明度(blend)为0所以暂时看不到)
repeat with i=2 to 12
set the visible of sprite i to 1
end repeat
--设置菜单和阴影的位置为鼠标点击的位置(使菜单能动态跟随鼠标)
set the loc of sprite 2 to the mouseloc
set the loc of sprite 3 to the mouseloc
--菜单选择棒动态跟随菜单(以菜单的位置为基准坐标,相对地改变选择棒位置)
repeat with i=1 to 9
--96 是菜单选择棒相对于菜单水平坐标的偏移值
sprite (i+3).loch = sprite(3).loch + 96
--32 是菜单选择棒相对于菜单垂直坐标的偏移值
--19 是菜单棒的高度
sprite (i+3).locv = sprite(3).locv + 32 + (i-1)*19
end repeat
--菜单的淡入淡出效果(透明度从10渐变到100)
repeat with i=10 to 100
set the blend of sprite 3 to i
i=i+10
updateStage
end repeat
end
--隐藏菜单事件(只是将通道2至12关闭,使其不可见)
on HideMenu
repeat with i=2 to 12
set the visible of sprite i to 0
end repeat
end
上一页 [1] [2] [3] [4] [5] [6] 下一页
b.编写菜单项选择棒行为脚本(响应范围只限于赋予本行为的角色),按窗口上角的 按钮,新建一个脚本,起名为“Show Bar Script”,设置其脚本类型(type)为“behavior”。然后在脚本编辑窗口里写入以下脚本:
--当鼠标移入当前菜单选择棒时,即用户选中某菜单项了
--让鼠标指针变成小手形状,且把菜单选择棒的透明度改成100(完全可见)
on mouseEnter
sprite (the currentSpriteNum).blend = 100
cursor 280
end mouseEnter
--当鼠标移出当前菜单选择棒时,即用户不选某菜单项了
--把鼠标指针还原成原来指针形状,且把菜单选择棒的透明度改成0(不可见)
on mouseLeave
sprite (the currentSpriteNum).blend = 0
cursor -1
end mouseLeave
--当用户在某一菜单选择棒上按下鼠标时,执行相应的操作
on mouseDown
-- 通过 the currentSpriteNum(鼠标点击的菜单选择棒的角色编号) 属性,
-- 可以让计算机知道用户选择的菜单项,进而使计算机做出相应的操作。
case (the currentSpriteNum) of
4:alert"跳转到 Windows XP 画面!"
5:alert"跳转到 Windows 2000 画面!"
6:alert"跳转到 Windows NT workstation 4.0 画面!"
7:alert"跳转到 Windows NT Sever 4.0 画面!"
8:alert"跳转到 Windows ME 画面!"
9:alert"跳转到 Windows 98 画面!"
10:alert"跳转到 Windows 95 画面!"
11:alert"跳转到 Windows CE 3.0 画面!"
12:alert"跳转到 Windows NT Embedded 画面!"
end case
end mouseDown
上一页 [1] [2] [3] [4] [5] [6] 下一页
c.编写画面行为脚本(相应范围是当前帧),按窗口上角的 按钮,新建一个脚本,起名为“Frame Script”,设置其脚本类型(type)为“behavior”。然后在脚本编辑窗口里写入以下脚本:
on exitFrame me
go the frame
end
--当鼠标右键按下时显示菜单
on rightmousedown
ShowMenu
end
--当鼠标按下时显示菜单
on mouseup
HideMenu
end
OK! 脚本写完了!我们来做最后一步吧——“灵魂附体”!呵呵!

图 7
上一页 [1] [2] [3] [4] [5] [6] 下一页
5.给角色植入“灵魂”
(1)打开分镜表,单击第1帧画面的画面脚本(如图7),将“脚本列表”中的“Frame Script”脚本拖至其中。
(2)打开分镜表(已打开 上一页 [1] [2] [3] 下一页
|