#12001/2/3 17:12:27
这是Macromedia 的一篇Technote.
Question:
How do I avoid the dreaded "Where is..." dialog?
Answer:
Many developers discover the problem of changing drive letters, and file paths after they have pressed their first CD-ROM, only to get the dreaded "Where is..." dialog. This document will show you how to set up your CD-ROM properly, so that you will get it right the first time.
Using the searchPaths and the pathName
Director includes two very important commands regarding file paths. These commands are the searchPaths and the pathName. The searchPaths command tells Director where to look for media files, and the pathName returns the path to the current Director movie. By using these two functions, you can avoid path problems.
Many developers organize their CD-ROM with their projector on the root of the CD-ROM with the content organized in sub-directories. This provides an organized look, and is intuitive to the user, since there are only a few files to click on. This design also makes it fairly easy to tell Director where to find content files.
When Director tries to load a media file it first looks for the path that it was originally linked to, if it does not find it there it will look in the same directory or folder as your movie. If it still cannot find the file, it looks through the directories listed in the searchPaths. The searchPaths is a list that may be appended with many paths. So for example, lets say you have a projector on the root of your CD-ROM with linked Quicktime files located in a sub-directory called QUIKTIME. You also have sound files located in a SOUND directory. You can tell Director to search these directories with the following statement:
on startMovie
append the searchPaths, the moviePath & "quicktime"
append the searchPaths, the moviePath & "sound"
end
Note: As of Director 6, the command "moviePath" replaced the earlier command "pathName".
The append command adds this path to the current searchPaths. The next command on that line is "the pathName" which returns the path to the current movie. Since the projector is on the root of the CD-ROM this command would return "D:\" or whatever the CD-ROM drive letter is. Then we add the directory name to the pathname, so that the final path added to the searchPaths is "D:\QUIKTIME" The next line does the same thing for the sound directory. Now Director will look through these directories for linked media files.
Note: You must put these scripts in a movie that does not load any of the media files from the directories specified in the searchPaths command. A good approach would be to just have your first movie set up the searchpaths in the movie script, then in frame 1, branch to your intro or main movie using the command:
go to movie "main"
编辑历史:[这消息被flyingbird编辑过(编辑时间2001-02-03 17:14:56)]