
andysgi.rit.edu
www.it.rit.edu
The shift to JavaScript syntax is a major advancement to Macromedia Director, and is important for a number of reasons. The feature provides a more common language and syntax between Macromedia Flash MX and Macromedia Director. In Director, the language implementation is on top of the SpiderMonkey engine [1], which is a pre-packaged ECMAScript interpreter written in C and complies largely to the ECMA specification [2], except in areas where custom functions or keywords expose Director-specific functionality.
For the first time, a standards-compliant and robust language choice is available in Director. It allows developers with expertise in ActionScript, JavaScript syntax, or traditional programming languages such as Java/C/C++ to more effectively use that knowledge within the Director MX 2004 environment. At the Rochester Institute of Technology, several of the faculty and students have experience with various scripting languages—the opportunity for programmers to work in a common language in Director MX, Macromedia Flash, and the web has long been a desire.
If you're familiar with any of the aforementioned languages, then the fundamental issue is learning how the JavaScript syntax implementation in Director MX wraps around traditional Lingo features. To that end, I explain a project that uses JavaScript syntax exclusively, and that uses features that developers use most commonly in Director (the Shockwave3D and Havok modules). The project also demonstrates several of the new features in object-oriented design. Please note that the code in this article is not a complete application—in fact, it is a prototype for a more complex tool that I plan to write in native code. I often use Director as a prototyping tool; in this article, I use Director to test whether the visualizations of the file system (See Figure 1) are effective enough to require a more robust, lower-level program.
Figure 1: Sample visualizations from the demo code-base, depicting “interactive mode” [top] and “render mode” scenes of a typical Windows XP installation at a search depth of three levels.
To complete this tutorial you will need to install the following software and files:
Originally, the ECMAScript standard described a language created by Brendan Eich at Netscape [2] and appeared in the Netscape 2.0 Internet browser in early 1994. Since that time, several companies have integrated a similar language into their products under competing names, two of the most well known are JavaScript (Netscape) and JScript (Internet Explorer / Microsoft). Several versions of the language existed, each with minor differences, prompting the need for a common standard across implementations—the first release of the ECMA standard was in 1998
Since that time, updated specifications have reflected changes and advancements in the technology. The latest standard is ECMA-262 Edition 3 (ISO/IEC 16262) and errata [3]. When Netscape began the open-source Mozilla project, they released the SpiderMonkey engine, which is a C implementation of the langauge that developers can plug into other products for ECMAScript support. Director MX 2004 builds its JavaScript syntax on top of this framework.