当前所在位置:珠峰网资讯 >> 计算机 >> IT教育 >> 正文
Director教程-AVI播放器制作(一)
发布时间:2008/2/25 8:13:09 来源:xue.net 编辑:城市教育在线
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
(5) 将Cast演员lau、lu、playu、stopu、ru、rau,分别拖动到舞台上,生成精灵2、3、4、5、6、7,调整位置如图7-149所示。
图7-149 生成精灵
(6) 在工作窗口单击工具栏中的Script按钮,弹出Script窗口,设置脚本类型为Movie,在其中输入以下全局变量,如图7-150所示。
on startmovie
  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("rd")
  set the castnum of sprite 7 to member("rad")
end
图7-150  Movie脚本
(7) 双击Script通道的第2帧单元格,打开Script窗口,输入以下Lingo语句,如图7-151所示。
on exitFrame me
  go to the frame
end
图7-151  第2帧的Lingo脚本
(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脚本
广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved