Using scriptInstanceList
You can use the
Normally,
scriptInstanceList
initializers defined in the Score. If you add child objects created from parent scripts to this list, the
child objects receive the messages sent to other behaviors.
For example, the following statement adds a child object to the
of sprite 10:
-- Lingo syntax
add(sprite(10).scriptInstanceList, new(script "rotation", 10))
The following is a possible parent script that the previous statement refers to:
-- Lingo syntax parent script "rotation"
property spriteNum
on new me, aSpriteNum
spriteNum = aSpriteNum
return me
end
on prepareFrame me
sprite(spriteNum).rotation = sprite(spriteNum).rotation + 1
end
When a child object is added to
property. Typically, you do this from a parameter passed in to the
spriteNum
Note: The
beginSprite
For reference information on
Using actorList
You can set up a special list of child objects (or any other objects) that receives its own message
each time the playhead enters a frame or the
The special list is
the list.
The message is the
updateStage()
Objects in
actorList
frame. If the objects have an
time the playhead enters a new frame or the
Some possible uses of
sprites or to update a counter that tracks the number of times the playhead enters a frame.
An
on enterFrame
handler are optimized for performance in Director. Objects in
stepFrame
more efficiently to
after an
updateStage()
scriptInstanceList
is the list of behavior instances created from the behavior
scriptInstanceList
message is not sent to dynamically added child objects.
scriptInstanceList
, which contains only objects that have been explicitly added to
actorList
message that is sent only when the playhead enters a frame or the
stepFrame
command is used.
receive a
stepFrame
on stepFrame
and
actorList
handler could achieve the same results, but the
messages than to
stepFrame
method.
property to dynamically add new behaviors to a sprite.
, you must initialize the child object's
, see
"scriptInstanceList" on page
updateStage()
message instead of an
handler available, the script in the handler runs each
updateStage()
are to animate child objects that are used as
stepFrame
enterFrame
Object-oriented programming with Lingo
scriptInstanceList
on new
method updates the Stage.
message at each
enterFrame
method updates the Stage.
property and
actorList
actorList
messages or custom messages sent
property
handler.
975.
respond
61
Need help?
Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?
Questions and answers