User Guide

addChild 233
Parameters
whichCamera
Required. A reference to the camera to add to the list of cameras for the sprite.
index Required. An integer that specifies the index in the list of cameras at which whichCamera
is added. If
index is greater than the value of cameraCount(), the camera is added to the end of
the list.
Example
This statement inserts the camera named FlightCam at the fifth index position of the list of
cameras of sprite 12:
--Lingo syntax
sprite(12).addCamera(member("scene").camera("FlightCam"), 5)
// JavaScript syntax
sprite(12).addCamera(member("scene").camera("FlightCam"), 5);
See also
cameraCount(), deleteCamera
addChild
Usage
-- Lingo syntax
member(whichCastmember).node(whichParentNode).addChild(member\
(whichCastmember).node(whichChildNode) {,#preserveWorld})
// JavaScript syntax
member(whichCastmember).node(whichParentNode).addChild(member\
(whichCastmember).node(whichChildNode) {,symbol(preserveWorld)})
Description
3D command; adds a node to the list of children of another node, and removes it from the list of
children of its former parent.
An equivalent to this method would be to set the
parent property of the child node to the
parent node.
Parameters
addMemberRef Required. A reference to the cast member that contains the node to add.
addNodeRef Required. A reference to the node to add. This node can be a model, group, camera,
or light.
symPreserveParentOrWorld Optional. A reference to the camera to add to the list of cameras
for the sprite. Valid values are
#preserveWorld or #preserveParent. When the child is added
with
#preserveParent specified, the parent-relative transform of the child remains unchanged
and the child jumps to that transform in the space of its new parent. The child’s world transform
is recalculated. When the child is added with
#preserveWorld specified, the world transform of
the child remains unchanged and the child does not jump to its transform in the space of its new
parent. Its parent-relative transform is recalculated.