4.撰写lingo脚本
(1)程序构思:当用户在舞台范围内点击鼠标右键时,在鼠标右键点击的位置,淡入淡出地弹出(显示)一个快捷菜单,让用户选择他要观看的内容,按下鼠标左键后选定内容,然后让计算机执行相应的演示。
(2)程序实现
a.编写菜单控制脚本(响应范围是全局的),按 打开脚本编辑窗口,起名为“Menu Control Script”,按脚本编辑窗口右上角的 
然后在脚本编辑窗口里写入以下脚本:
--程序初始化
on startMovie
-- 开始时菜单应为不可见,直到用户点击鼠标右键时才显示,所以先隐藏菜单
HideMenu
--初始化菜单和菜单阴影的基点(使其能显示在正确的位置)
set the regpoint of member "menu" to point(0,0)
set the regpoint of member "shadow" to point(0,0)
alert“在舞台范围内按鼠标右键观看效果!”
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
观看地址: http://www.qqread.com/director/g524387000.html进入讨论组讨论。
(1)程序构思:当用户在舞台范围内点击鼠标右键时,在鼠标右键点击的位置,淡入淡出地弹出(显示)一个快捷菜单,让用户选择他要观看的内容,按下鼠标左键后选定内容,然后让计算机执行相应的演示。
(2)程序实现
a.编写菜单控制脚本(响应范围是全局的),按

(属性)按钮,设置其脚本类型(type)为“movie”。
然后在脚本编辑窗口里写入以下脚本:
--程序初始化
on startMovie
-- 开始时菜单应为不可见,直到用户点击鼠标右键时才显示,所以先隐藏菜单
HideMenu
--初始化菜单和菜单阴影的基点(使其能显示在正确的位置)
set the regpoint of member "menu" to point(0,0)
set the regpoint of member "shadow" to point(0,0)
alert“在舞台范围内按鼠标右键观看效果!”
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
观看地址: http://www.qqread.com/director/g524387000.html进入讨论组讨论。
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- Director MX 2004教程--我的第一个作品 (822次浏览)
- Director 8.5 简单基础实例教程(五) (649次浏览)
- Director Lingo 语言入门(1) (578次浏览)
- 多媒体教学软件开发经验谈 (564次浏览)
- Director MX 2004教程--用Lingo语法和JavaSc (531次浏览)
- Director Lingo 语言入门(2) (444次浏览)
- Director 8.5 简单基础实例教程(八) (440次浏览)
- 制作具有Win XP 风格的菜单 (429次浏览)
- ShockWave 3D 制作系列教程之三 (426次浏览)
- Power Director 3快速上手 (425次浏览)



