Director Help

addCamera

Usage

-- Lingo syntax
sprite(whichSprite).addCamera(whichCamera, index)
-- JavaScript syntax
sprite(whichSprite).addCamera(whichCamera, index);

Description

3D command; adds a camera to the list of cameras for the sprite. The view from each camera is displayed on top of the view from cameras with lower index positions. You can set the rect property of each camera to display multiple views within the sprite.

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").getPropRef("camera", i), 5);
// where i is the number index for the camera "FlightCam".

See also

cameraCount(), deleteCamera