The Director Object Model
The Director Object Model, or DOM, is new in Director MX 2004. Web developers will likely notice the similarity between the Director DOM and the Document Object Model in use on the Web. The DOM provides a tree-like interface that exposes the entire Director environment through a series of logically organized objects. Those objects fall into four general classifications: Core Objects, Media Types, Scripting Objects, and 3D Objects.The Core Objects provide access toyou guessed itthe core functionality and features such as sprites, movies in a window, the player engine, and more. You probably didn't realize it, but you've already used the DOM to loop on a frame using _movie.go(_movie.frame). In fact, that single line of code accesses the DOM twice: to call the movie's go() method, and to get the movie's current frame.Media Types take the basic cast member object and extend it with methods and properties specific to the kind of media you're working with. This includes Flash assets, RealMedia, DVD Members, and others. Take for example a DVD cast member that you've imported. You can use member("dvdMember").rect to get the RECTangle of the cast member. The rect property is a standard command available to all cast members allowing you to get and set the dimensions of the cast member. However you can also use the member("dvdMember").titleMenu() method on a DVD member to get to the title screen. The titleMenu() method is available only to DVD media types.The Scripting Objects, aka Xtra extensions, extend the core functionality of Director and are created by Macromedia and by many third-party developers. Xtras enable Director to do things not available with the core functionality, including reading and writing files, playing video, hooking into a database, and accessing operating system features. To see a complete list of available Xtras, visit Lesson 3 you swapped a sprite's member using Lingo like sprite(3).member = member("button_hi"). Now, if you'll look at the preceding image you'll notice that the sprite object is subordinate to the movie object, which itself is subordinate to the player object. However, you didn't need to specify the entire hierarchy from _player down in order to access the sprite object. This is because Macromedia provides top-level functions and properties for commonly used items.
Top-Level Functions and Properties
There are a number of top-level functions and properties that provide direct access to core objects without having to traverse the hierarchy to get to them. The sprite() function, which you used previously, is a top-level function that returns a reference to a sprite in the Score. You've also used the top-level _movie property for looping on a frame. The _movie property returns a reference to a movie objectwhich is the currently active movie running in the player.As you progress with your learning of Lingo you'll make extensive use of the top-level functions and properties, as well as using the DOM's hierarchy to access items such as a Movie In A Window (MIAW).A complete list of the top-level functions and properties appears in the following table. For a detailed description of each item you should consult Director's Help using Help > Director Help from the top menu.