为什么Director总是报告“where is ......”(找不到链接的媒体文件)?

很多人以链接方式导入的媒体文件,如QuickTime、wav、aiff、avi等,或用DMX插件引入MPG视频文件在变换了路径后会出现找不到媒体文件的情况。
  解决方法很简单,那就是使用the ssearchpaths这个系统属性列表。the searchpaths告诉Director到哪里去找媒体文件。通常我们将媒体文件以一种层次结构方式组织在光盘上,例如projector文件放在光盘的根目录下,声音文件放在sounds目录下,视频文件放在video目录下。
  当Director加载媒体文件的时候.,它会首先查看媒体文件最初的连接地址,如果没有找到该文件,会接着在电影文件的当前目录下查找该媒体文件,如果还是没有找到,它就遍历the searchpaths中的所有路径。the searchpaths中的每一个项目就是一个路径。因此解决方法就是在每个Director电影文件的movie script中加入句柄:
  on startmovie
  append the searchpaths, the moviepath&“video”
  append the searchpaths, the moviepath&“sounds”
  end
  the moviepath返回当前电影文件的路径名,例如果光盘是d盘,电影文件放在光盘根目录下,那么the moviepath就返回d:\,和“video”结合就成了d:\video,合并后的路径通过append附加在the searchpaths后,Director就知道到什么地方查找该文件了。
或者在项目的根目录下建立一个lingo.ini文件,以下为我对VCD/多媒体双轨光盘的一段代码:
on startup
set the soundkeepdevice to 0
global tbsearchpath
set tbsearchpath=[]
append(tbsearchpath, the applicationPath & “MPEGAV”)
append(the searchpaths, the applicationPath &“MPEGAV”)
end startup
电影文件放在硬盘上、媒体文件放在光盘的具体实现
  1.在你的光盘中放入一个很特殊的文件(名字尽量不要和可能出现在任何盘的根目录下的文件重名),比如你公司的名字(soshow.org.txt)。
  2.编写判断光盘驱动器的函数:
  on checkdrive uniquefile
  repeat with i = 67 to 90 --字母a到z的循环
  set drive = numtochar( i )
  --将a到z的ascii码转换为字符
  set thispath = string(drive&“:”&uniquefile)
  set myfile = new(xtra"fileio")
  --创建fileio xtra的实例
  openfile(myfile, thispath, 1)
  --打开指定的文件
  if status(myfile) = 0 then
  --如果打开文件成功返回0
  set myfile = 0 --从内存中删除该实例的指针并返回drive&“:”
  exit
  end if
  end repeat
  set myfile = 0
  --从内存中删除该实例的指针
  alert"请插入正确的光盘"
  end
  3.编写你的movie script脚本:
  on startmovie
  mycd = checkdrive(“soshow.org.txt”)
  append the searchpath, mycd&“\video”
  append the searchpath, mycd&“\sounds”
  end
  这样就可以在光盘上放置媒体文件,把Director电影文件放在硬盘上,而不必担心会出现问题了。

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值