thanks to the extensive range of xtras available, a director projector can create any type of document and write it to the users hard disk. in windows explorer and the macintosh finder, users expect that a double-click on a document icon will launch the program that created it. this article shows you how to associate files with the director projector that created them. by the end of this article, you will have created a simple word processor application that creates its own document files; double-clicking on the icon of one of these files will open your director application so that you can edit the document.
there are many situations in which this technique will prove useful. for example, you may want to save the state of a game in progress, a customized slide show presentation, or mark up data for a video sequence.
but recognizing the files created by a projector is not something that director does naturally. by default, when the user double-clicks on a document created by a director projector, the operating system prompts the user to select an application to open the file. if the user properly selects your projector, then your projector is launched, but the document still doesnt open.
for my programs, this is unacceptable. i sell programs that are often in direct competition with titles from major software vendors. something like the double-click may seem trivial, but the little things add up and the less my users have to think about, the more likely they are to purchase the product. i like my projectors to be as professional as possible, complete with robust menus, keyboard shortcuts, user-defined preferences, and standard user-interface elements. in the end, if the user cant tell that the program was created with director, then ive done my job. this means finding a way to deal with double-clicking on documents.
thankfully director has an undocumented feature - a system variable called the commandline that corresponds to the operating systems command line. when the user double-clicks on a document, the operating systems command line gets updated with the path to the document, and directors commandline provides us with this information.
but figuring out which document the user clicked on is only half the battle. the operating system also needs to be told to launch your projector instead of prompting the user, and then your application has to be set up to deal with what happens so the file actually opens. this article will give you step by step instructions for getting this to work for macintosh osx and windows platforms. the commandline doesnt exist on pre-osx macintosh operating systems because those systems dont have a command line at all. so, this technique will not work on os8 or os9.
this article assumes you have a basic understanding of lingo, movie scripts, frame scripts, and working with xtras. you will also need some additional tools besides director. for mac osx, you will need ... 下一页