Director 8.5支持多种视频格式,包括常用的MOV和AVI视频格式。本节实例将介绍创建AVI播放器,通过控制按钮,可以对AVI进行视频播放、停止、快进、快退等操作。
AVI播放器制作操作步骤如下:
(1) 进入Director 8.5。执行Modify→Movie→Properties命令,在弹出的舞台属性检查器对话框中将电影舞台的大小设置为500×400,将背景颜色设置为白色,如图7-145所示。
图7-145 设置舞台的属性
(2) 按Ctrl+R组合键,导入12张图片,在Cast窗口中显示,如图7-146所示。
图7-146 导入12张图片
(3) 按Ctrl+R组合键,在Import窗口导入AVI电影,单击OK按钮,在弹出的Select Format对话框中选择AVI格式,如图7-147所示。
图7-147 导入AVI电影
(4) 将Cast演员“动画”拖动到舞台上,调整其大小与位置,生成精灵1,效果如图7-148所示。
图7-148 生成精灵1
3D7fe2ea82ed47355ecad width=245>
(8) 选中舞台上的精灵2,单击右键,在快捷菜单中选择Script命令,打开Script窗口为其添加以下的Lingo语句,如图7-152所示。
on mouseUp me
set the movieTIMe of sprite 1 to 0
set the movierate of sprite 1 to 0
set the castnum of sprite 2 to member("lad")
set the castnum of sprite 3 to member("ld")
set the castnum of sprite 4 to member("playu")
set the castnum of sprite 5 to member("stopd")
set the castnum of sprite 6 to member("ru")
set the castnum of sprite 7 to member("rau")
updatestage
end
图7-152 精灵2的Lingo脚本
(9) 选中舞台上的精灵3,打开Script窗口为其添加以下的Lingo语句,如图7-153所示。
on mouseUp me
set the castnum of sprite 2 to member("lau")
set the castnum of sprite 3 to member("ld")
set the castnum of sprite 4 to member("playu")
set the castnum of sprite 5 to member("stopu")
set the castnum of sprite 6 to member("ru")
set the castnum of sprite 7 to member("rau")
updatestage
set the movierate of sprite 1 to–2
end
图7-153 精灵3的脚本
(10) 选中舞台上的精灵4,打开Script窗口为其添加以下的Lingo语句,如图7-154所示。
on mouseUp me
set the movierate of sprite 1 to 1
set the castnum of sprite 2 to member("lau")
set the castnum of sprite 3 to member("lu")
set the castnum of sprite 5 to member("stopu")
set the castnum of sprite 6 to member("ru")
set the castnum of sprite 7 to member("rau")
end
图7-154 精灵4的Lingo脚本
(11) 选中舞台上的精灵5,打开Script窗口为其添加以下的Lingo语句,如图7-155所示。
on mouseUp me
if (the castnum of sprite 7 = 8) then
set the movietime of sprite 1 to the duration of the member of sprite 1
set the castnum of sprite 2 to member("lau")
set the castnum of sprite 3 to member("lu")
set the castnum of sprite 4 to member("playd")
set the castnum of sprite 5 to member("stopu")
set the castnum of sprite 6 to member("rd")
set the castnum of sprite 7 to member("rad")
updatestage
end if
end
图7-155 精灵5的Lingo脚本
(12) 选中舞台上的精灵6,打开Script窗口为其添加以下的Lingo语句,如图7-156所示。
on mouseUp me
set the movierate of sprite 1 to 2
set the castnum of sprite 2 to member("lau")
set the castnum of sprite 3 to member("lu")
set the castnum of sprite 4 to member("playu")
set the castnum of sprite 5 to member("stopu")
set the castnum of sprite 6 to member("rd")
set the castnum of sprite 7 to member("rau")
updatestage
end
图7-156 精灵6的Lingo脚本
(13) 选中舞台上的精灵7,打开Script窗口为其添加以下的Lingo语句,如图7-157所示。
on mouseUp me
if (the castnum of sprite 5 = 12) then
set the movierate of sprite 1 to 0
set the castnum of sprite 5 = member("stopd")
updatestage
end if
end
图7-157 精灵7的Lingo脚本
(14) 至此,AVI播放器动画的制作完成了,播放电影,效果如图7-158所示。
图7-158 AVI播放器播放效果