#12000/12/22 18:05:23
这是macromedia的一篇technote,发表日期是本月15日。 我想它至少透露了一个有价值的信息, 也可以让朋友们了解一些机制和原理。 推荐如下。(文中黑体是我加的)
Can I use Director in Asymetrix Toolbook? other apps?
There's not a ready and general method for interapplication communication (IAC) across both platforms -- this is not a core part of Director. On Macs you can often hack IAC by calling up a compiled AppleScript, if the delivery machine is configured for AppleScript. (There have been various AppleEvent XCMDs in previous years, but these do not seem to be used as much today as they were in the early '90s.)
FileIO work is the base cross-platform method of data exchange between programs. It's clumsy, but has been used successfully in a number of projects. The key strategy is to poll for the existence of a certain text file in a certain directory location. If the file exists when polling, use FileIO to read its contents and then delete the file. Resume polling to catch any new instructions that may arrive. To communicate from Director to the other app, you'd write a different text file with the data or instructions to a known location, so that the other application can read it and delete this message. You'd need to set the polling cycle so as not to interfere with the performance of either application -- this technique is not good for rapid-fire messaging, but can be helpful if information exchange is on a relatively slow cycle.
On Windows Dynamic Data Exchange was an early method of IAC, by passing messages through the Clipboard. In Director you can communicate with the Clipboard directly, and so if a parallel ability is available in Toolbook or your desired host application then there may be possibilities here.
The Director playback engine is available as an ActiveX Control for Win95/NT (not Win3.1). This can be freely downloaded by individuals but requires licensing for redistribution on CD, behind intranet firewalls, or similar situations. (Shockwave is free for all to use, but not to redistribute.) The D6 ActiveX Control supports client/host intercommunication through the outgoing "externalEvent" message and the incoming "evalScript()" handler. At time of writing (Aug 97) the next version of Toolbook is said to be able to host ActiveX Controls, as Authorware 4 can do out of the box or as Director 6 can do with Mauricio Piacentini's WebXtra or the ActiveX Asset Xtra that ships with Authorware 4. The Asymetrix engineers have been experimenting with Shockwave ActiveX support, and so there may be some possibilities here in the next version of Toolbook.
But if you're running the Director engine within another application there are things to manage such as increased RAM costs, increased system resource costs, timesharing, possible palette contention, and focus issues, in addition to the IAC work itself.
If the goal is to have Director content within Toolbook, Visual Basic, or another Windows application, then a low-impact way to achieve this goal might be to export the Director animation as an AVI file. This eliminates much overhead. If you need to click on a button in the Director piece and pass information to the host, then this can often be simulated by having the host trap for mouse events within certain coordinates on the screen -- it would appear that you're clicking a button in Director, but actually the button is just an area of the AVI display, and the actual mouse event goes to the host application. If the host can control which frame of an AVI displays then you can even appear to give different artwork when the button is pressed, by advancing to a frame with different art for the button.
Summary:
Director is more of an application than a component. Work has been done over the last two years to turn Director into a component for the Netscape and Microsoft browsers. At time of writing, this componentization of Director is on the verge of becoming a general ability that various other host applications can use.
编辑历史:[这消息被flyingbird编辑过(编辑时间2000-12-22 18:11:08)]
[这消息被flyingbird编辑过(编辑时间2000-12-22 18:14:48)]