114
Chapter 5: Director Core Objects
Sprite Channel
Represents an individual sprite channel in the Score.
A Sprite object covers a sprite span, which is a range of frames in a given sprite channel. A Sprite
Channel object represents an entire sprite channel, regardless of the number of sprites it contains.
Sprite channels are controlled by the Score by default. Use the Sprite Channel object to switch
control of a sprite channel over to script during a Score recording session.
A sprite channel can be referenced either by number or by name.
•
When referring to a sprite channel by number, you access the channel directly. This method is
faster than referring to a sprite channel by name. However, because Director does not
automatically update references to sprite channel numbers in script, a numbered reference to a
sprite channel that has moved position in the Score will be broken.
•
When referring to a sprite channel by name, Director searches all channels, starting from the
lowest numbered channel, and retrieves the sprite channel’s data when it finds the named sprite
channel. This method is slower than referring to a sprite channel by number, especially when
referring to large movies that contain many cast libraries, cast members, and sprites. However,
a named reference to a sprite channel allows the reference to remain intact even if the sprite
channel moves position in the Score.
You can create a reference to a Sprite Channel object by using the top level
channel()
method,
and referring to either the channel number or name.
-- Lingo syntax
objSpriteChannel = channel(2) -- numbered reference
objSpriteChannel = channel("background") -- named reference
// JavaScript syntax
var objSpriteChannel = channel(2); // numbered reference
var objSpriteChannel = channel("background"); // named reference
You can use a reference to a Sprite Channel object to access the sprite that is currently being used
in a particular sprite channel. The following example illustrates accessing the background color of
the sprite that is currently being used in sprite channel 2.
-- Lingo syntax
labelSprite = channel(2).sprite.backColor
// JavaScript syntax
var labelSprite = channel(2).sprite.backColor;
Method summary for the Sprite Channel object
Method
makeScriptedSprite()
removeScriptedSprite()
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...