MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference page 930

Director scripting reference
Table of Contents

Advertisement

Example
This example has two parts. The first part is the first line of code, which registers the
handler for the
#collideAny
in the cast member MyScene collide, the
argument is sent to it. The first nine lines of the
named SparkSource and set its properties. This model resource is a single burst of particles. The
tenth line of the handler creates a model named SparksModel using the model resource named
SparkSource. The last line of the handler sets the position of SparksModel to the position where
the collision occurred. The overall effect is a burst of sparks caused by a collision.
member("MyScene").registerForEvent(#collideAny, #explode, 0)
on explode me, collisionData
nmr = member("MyScene").newModelResource("SparkSource",
nmr.emitter.mode = #burst
nmr.emitter.loop = 0
nmr.emitter.minSpeed = 30
nmr.emitter.maxSpeed = 50
nmr.emitter.direction = vector(0, 0, 1)
nmr.colorRange.start = rgb(0, 0, 255)
nmr.colorRange.end = rgb(255, 0, 0)
nmr.lifetime = 5000
nm = member("MyScene").newModel("SparksModel", nmr)
nm.transform.position = collisionData.pointOfContact
end
See also
modelA,
modelB
position (transform)
Usage
member(whichCastmember).node(whichNode).transform.position
member(whichCastmember).node(whichNode).getWorldTransform().\
position
transform.position
Description
3D property; allows you to get or set the positional component of a transform. A transform
defines a scale, position and rotation within a given frame of reference. The default value of this
property is
vector(0,0,0)
A node can be a camera, group, light or model object. Setting the
transform defines that object's position within the transform's frame of reference. Setting the
position property of an object's world relative transform using
defines the object's position relative to the world origin. Setting the position property of an
object's parent relative transform using
to its parent node.
The
worldPosition
getWorldTransform().position
930
Chapter 14: Properties
event. The second part is the
#explode
.
transform.position
property of a model, light, camera or group object is a shortcut to the
version of this property for that object.
handler. When two models
#explode
handler is called and the
handler create the model resource
#explode
#particle)
position
getWorldTransform().position
defines the object's position relative
#explode
collisionData
of a node's

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Director mx 2004

Table of Contents