Introducing the Director objects
51
To identify chunks of text, include terms after the dot to refer to more specific items within text.
For example, the first statement below refers to the first paragraph of the text cast member named
"News Items". The second statement below refers to the second word in the first paragraph.
-- Lingo syntax
member("News Items").paragraph[1]
member("News Items").paragraph[1].word[2]
// JavaScript syntax
member("News Items").getPropRef("paragraph", 1);
member("News Items").getPropRef("paragraph", 1).getProp("word", 2);
For certain objects that handle cascading property access to either data or a specific cast member
type, as illustrated in the previous two statements, access to the properties is not supported by
using normal JavaScript syntax. Therefore, you must use the
getPropRef()
and
getProp()
methods to access cascading properties in JavaScript syntax.
There are a few things to note about this JavaScript syntax exception:
•
This technique must be applied to 3D objects, text cast members, field cast members, and
XML Parser Xtra extensions accessed by using JavaScript syntax.
•
You must use the
getPropRef()
method to store a reference to one of the previously
mentioned objects or its properties by using JavaScript syntax.
•
You must use the
getProp()
method to retrieve a property value of one of the previously
mentioned objects or its properties by using JavaScript syntax.
•
3D objects and properties must be accessed by using their fully qualified names in JavaScript
syntax. For example, in Lingo, the property
shader
can be used as a shortcut for the property
shaderList[1]
. However, in JavaScript syntax, the property
shaderList[1]
must be used at
all times.
Introducing the Director objects
In basic terms, objects are logical groupings of named data that also can contain methods that act
on that data. In this release of Director, the scripting APIs have been grouped into objects and are
accessed through these objects. Each object provides access to a specific set of named data and
type of functionality. For example, the Sprite object provides access to the data and functionality
of a sprite, the Movie object provides access to the data and functionality of a movie, and so on.
The objects used in Director fall into the following four categories. Depending on the type of
functionality you want to add and the part of a movie you are adding functionality to, you will
use the objects from one or more of these categories:
•
Core objects
•
Media types
•
Scripting objects
•
3D objects
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...