Back to Content

CopperCube Actionscript 3 scripting reference


CopperCube provides a very simple interface to manipulate all aspects of a 3D scene. This interface is named SimpleAPI. When loading a CopperCube SWF file into your SWF file, you can get access to the SimpleAPI for example with the following code:
 package  
 {
    import flash.display.*
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.utils.getTimer;
 
    public class main extends Sprite 
    {
        private var fileToLoad:String = "SomeCopperCubeScene.swf"; 
        private var loader:Loader; 
        private var coppercubeSprite:DisplayObject;
        
        public function main()
        {  
             // load the coppercube scene from the other swf
             loader = new Loader();    
             addChild(loader);
   
             loader.load(new URLRequest(fileToLoad)); 
             loader.contentLoaderInfo.addEventListener(Event.INIT, onCoppercubeLoaded); 
             loader.addEventListener(Event.ENTER_FRAME, onGraphicsFrame);
        }  
  
        // called when the coppercube .swf file has been loaded
        private function onCoppercubeLoaded(e:Event):void 
        {     
             // get access to the loaded CopperCube sprite:
             coppercubeSprite = loader.content as DisplayObject;
        }
  
        // called every frame
        public function onGraphicsFrame(event:Event):void
        {
            if (coppercubeSprite != null)
            {
                // try to get the simpleAPI object of copperCube. Will only work when CopperCube is fully initialized.
                var simpleAPI:Object = coppercubeSprite['simpleAPI'];
                
                if (simpleAPI && simpleAPI.isLoaded())
                {
                    // the coppercube sprite is finally loaded and initialized.
                    // example: change the zoom of the camera every frame
                    
                     simpleAPI.setCameraFieldOfView(null, 30 + (getTimer()/24 % 60));
                }
            }
        } 
    }
 }  
 
Note: When loading a CopperCube SWF file in this way locally, and you don't see any 3D objects, compile your SWF with the setting -use-network=false or start it from a webserver. In this example, the simpleAPI Object is available after the onCoppercubeLoaded() has been called, but the calls to it will only work after isLoaded() returns true.



Public Methods
 MethodDefined by
  
cloneSceneNode(scenenode:Object):Object
Creates an exact copy of a scene node.
ISimpleAPI
  
doesLineCollideWithBoundingBoxOfSceneNode(scenenode:Object, startX:Number, startY:Number, startZ:Number, endX:Number, endY:Number, endZ:Number):Boolean
Returns if the bounding box of the given scene node collides with the line between two given points.
ISimpleAPI
  
eraseSceneNode(scenenode:Object):void
Deletes a scene node from its parent and from the scene.
ISimpleAPI
  
get2DPositionFrom3DPosition(x:Number, y:Number, z:Number):Object
Returns the 2D pixel position on the screen from a 3D position.
ISimpleAPI
  
get3DPositionFrom2DPosition(x:Number, y:Number):Object
Returns a 3d point from a 2d pixel coordinate on the screen.
ISimpleAPI
  
getActiveCamera():Object
Returns the currently active camera scene node.
ISimpleAPI
  
getBillboardSize(billboardSceneNode:Object):Object
Returns the size of a billBoard scene node.
ISimpleAPI
  
getCameraAspectRatio(cameraSceneNode:Object):Number
Returns the aspect ratio of the camera.
ISimpleAPI
  
getCameraFieldOfView(cameraSceneNode:Object):Number
Returns the field of view (or also known as zoom) of the camera.
ISimpleAPI
  
getCameraTarget(cameraSceneNode:Object):Object
Returns the target of a camera scene node, the position where the camera looks at.
ISimpleAPI
  
getCameraUpVector(cameraSceneNode:Object):Object
Returns the up vector of a camera scene node, the direction where 'up' is for the camera.
ISimpleAPI
  
getCollisionPointOfWorldWithLine(startX:Number, startY:Number, startZ:Number, endX:Number, endY:Number, endZ:Number):Object
Returns the collision point with a line and the world.
ISimpleAPI
  
getCopperCubeVariable(varname:String):Object
Gets the value of a CopperCube variable.
ISimpleAPI
  
Returns the current rendered frames per second value.
ISimpleAPI
  
getLightColor(lightSceneNode:Object):int
Returns the color of a light scene node.
ISimpleAPI
  
getLightRadius(lightSceneNode:Object):Number
Returns the radius of a light scene node.
ISimpleAPI
  
getMaterialLighting(scenenode:Object, materialIndex:int):Boolean
Returns if dynamic lighting is used for a material
ISimpleAPI
  
getMaterialTexture(scenenode:Object, materialIndex:int):DisplayObject
Returns the texture of a scene node.
ISimpleAPI
  
getMaterialType(scenenode:Object, materialIndex:int):String
Returns the type of a material of a scene node.
ISimpleAPI
  
Returns the current background color of the active 3D scene
ISimpleAPI
  
getSceneNodeAbsolutePosition(scenenode:Object):Object
Returns an object representing the absolute position of a scene node.
ISimpleAPI
  
getSceneNodeBoundingBox(scenenode:Object, transformed:Boolean):Object
Returns the bounding box of a scene node.
ISimpleAPI
  
getSceneNodeByName(name:String):Object
Returns an object representing a scene node wich has the specified name.
ISimpleAPI
  
getSceneNodeChildren(scenenode:Object):Array
Returns all scene node children of a parent scene node.
ISimpleAPI
  
getSceneNodeMaterialCount(scenenode:Object):int
Returns the amount of materials of a scene node.
ISimpleAPI
  
getSceneNodeName(scenenode:Object):String
Returns the name of a scene node.
ISimpleAPI
  
getSceneNodePosition(scenenode:Object):Object
Returns an object representing the position of a scene node relative to its parent.
ISimpleAPI
  
getSceneNodeRotation(scenenode:Object):Object
Returns an object representing the rotation of a scene node relative to its parent.
ISimpleAPI
  
getSceneNodeScale(scenenode:Object):Object
Returns an object representing the scale of a scene node relative to its parent.
ISimpleAPI
  
getSceneNodeType(scenenode:Object):String
Returns the type of a scene node.
ISimpleAPI
  
getSceneNodeVisibility(scenenode:Object):Boolean
Returns if the scene node is set to visible or to invisible.
ISimpleAPI
  
Forces the view to be invalidated so it gets redrawn in the next frame.
ISimpleAPI
  
isLoaded():Boolean
Returns if the coppercube scene has been loaded.
ISimpleAPI
  
Rebuilds the collision geometry for the current scene.
ISimpleAPI
  
setActiveCamera(camera:Object):void
Sets the currently active camera scene node.
ISimpleAPI
  
setBillboardSize(billboardSceneNode:Object, w:Number, h:Number):void
Sets the size of a billBoard scene node.
ISimpleAPI
  
setCameraAspectRatio(cameraSceneNode:Object, aspectRatio:Number):void
Sets the aspect ratio of the camera.
ISimpleAPI
  
setCameraFieldOfView(cameraSceneNode:Object, fieldOfView:Number):void
Sets the field of view (or also known as zoom) of the camera.
ISimpleAPI
  
setCameraTarget(cameraSceneNode:Object, x:Number, y:Number, z:Number):void
Sets the look-at target position of a camera scene node.
ISimpleAPI
  
setCameraUpVector(cameraSceneNode:Object, x:Number, y:Number, z:Number):void
Sets the up vector of a camera scene node, a vector pointing to where 'up' is.
ISimpleAPI
  
setCopperCubeVariable(varname:String, value:Object):void
Sets the value of a CopperCube variable.
ISimpleAPI
  
setLightColor(lightSceneNode:Object, color:int):void
Sets the radius of a light scene node.
ISimpleAPI
  
setLightRadius(lightSceneNode:Object, radius:Number):void
Sets the radius of a light scene node.
ISimpleAPI
  
setMaterialLighting(scenenode:Object, materialIndex:int, dynamicLighting:Boolean):void
Sets the dynamic lighting flag of the material
ISimpleAPI
  
setMaterialTexture(scenenode:Object, materialIndex:int, texture:DisplayObject):void
Sets the texture of a scene node.
ISimpleAPI
  
setMaterialType(scenenode:Object, materialIndex:int, newMaterialType:String):void
Returns the type of a material of a scene node.
ISimpleAPI
  
Sets the current background color of the active 3D scene
ISimpleAPI
  
setSceneNodeAnimation(scenenode:Object, animationName:String):void
Sets the animation of an animated mesh scene node.
ISimpleAPI
  
setSceneNodeAnimationLoop(scenenode:Object, loop:Boolean):void
Sets the animation loop mode of an animated mesh scene node.
ISimpleAPI
  
setSceneNodeAnimationSpeed(scenenode:Object, framesPerSecond:Number):void
Sets the animation speed of an animated mesh scene node.
ISimpleAPI
  
setSceneNodeName(scenenode:Object, name:String):void
Sets the name of a scene node.
ISimpleAPI
  
setSceneNodeParent(scenenode:Object, parent:Object):void
Sets the parent of a scene node.
ISimpleAPI
  
setSceneNodePosition(scenenode:Object, x:Number, y:Number, z:Number):void
Sets the position of a scene node, relative to its parent.
ISimpleAPI
  
setSceneNodePositionWithoutCollision(scenenode:Object, x:Number, y:Number, z:Number):void
Sets a new position of a scene node, even if the scene node has a 'collide with walls' behavior attached to it.
ISimpleAPI
  
setSceneNodeRotation(scenenode:Object, x:Number, y:Number, z:Number):void
Sets the rotation of a scene node, relative to its parent.
ISimpleAPI
  
setSceneNodeRotationToLookAt(scenenode:Object, x:Number, y:Number, z:Number):void
Sets the rotation of a scene node to point to a specific position.
ISimpleAPI
  
setSceneNodeScale(scenenode:Object, x:Number, y:Number, z:Number):void
Sets the scale of a scene node, relative to its parent.
ISimpleAPI
  
setSceneNodeVisibility(scenenode:Object, visible:Boolean):void
Sets the visibility of a scene node.
ISimpleAPI
  
switchToScene(name:String):Boolean
Switches the another scene
ISimpleAPI
Method detail
cloneSceneNode()method
public function cloneSceneNode(scenenode:Object):Object

Creates an exact copy of a scene node.

Parameters
scenenode:Object — object representing the scene node to be cloned, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
Object — Returns an object representing the newly created scene node.
doesLineCollideWithBoundingBoxOfSceneNode()method 
public function doesLineCollideWithBoundingBoxOfSceneNode(scenenode:Object, startX:Number, startY:Number, startZ:Number, endX:Number, endY:Number, endZ:Number):Boolean

Returns if the bounding box of the given scene node collides with the line between two given points.

Parameters
scenenode:Object — object representing the scene node, can be retrieved for example using getSceneNodeByName().
 
startX:Number — X coordinate of the start point of the line.
 
startY:Number — Y coordinate of the start point of the line.
 
startZ:Number — Z coordinate of the start point of the line.
 
endX:Number — X coordinate of the end point of the line.
 
endY:Number — Y coordinate of the end point of the line.
 
endZ:Number — Z coordinate of the end point of the line.

Returns
Boolean — Returns true if a collision was detected and false if not.
eraseSceneNode()method 
public function eraseSceneNode(scenenode:Object):void

Deletes a scene node from its parent and from the scene.

Parameters
scenenode:Object — object representing the scene node to be erased, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
get2DPositionFrom3DPosition()method 
public function get2DPositionFrom3DPosition(x:Number, y:Number, z:Number):Object

Returns the 2D pixel position on the screen from a 3D position.

Parameters
x:Number
 
y:Number
 
z:Number

Returns
Object — Returns an object with the members .x and .y, representing the screen pixel position of the projected 3d point. Returns null if the point would be not on the screen, for example behind the camera.
get3DPositionFrom2DPosition()method 
public function get3DPositionFrom2DPosition(x:Number, y:Number):Object

Returns a 3d point from a 2d pixel coordinate on the screen. Note: A 2d position on the screen does not representate one single 3d point, but a actually a 3d line. So in order to get this line, use the 3d point returned by this function and the position of the current camera to form this line.

Parameters
x:Number — X pixel coordinate on the screen
 
y:Number — Y pixel coordinate on the screen

Returns
Object — Returns an object with the members .x, .y and .z, representing a 3d coordinate which is behind the given screen coordinate. Returns null if not possible or invalid.
getActiveCamera()method 
public function getActiveCamera():Object

Returns the currently active camera scene node. The active camera is the camera where the scene is rendered from.

Returns
Object — Returns an object representing the camera scene node.
getBillboardSize()method 
public function getBillboardSize(billboardSceneNode:Object):Object

Returns the size of a billBoard scene node.

Parameters
billboardSceneNode:Object — Object representing a billboard scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
Object — Returns an object with the members .x and .y, representing the width and height of the billboard. Returns null if the scene node is not a billboard.

See also

setBillboardSize
getCameraAspectRatio()method 
public function getCameraAspectRatio(cameraSceneNode:Object):Number

Returns the aspect ratio of the camera.

Parameters
cameraSceneNode:Object — Object representing a camera scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren(). If null, uses the currently active camera.

Returns
Number — Aspect ratio of the camera. For example for a 16:9 aspect ratio, this will return 1.777777 which is 16.0 / 9.0.

See also

setCameraAspectRatio
getCameraFieldOfView()method 
public function getCameraFieldOfView(cameraSceneNode:Object):Number

Returns the field of view (or also known as zoom) of the camera.

Parameters
cameraSceneNode:Object — Object representing a camera scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren(). If null, uses the currently active camera.

Returns
Number — Field of view of the camera, in degrees.

See also

setCameraFieldOfView
getCameraTarget()method 
public function getCameraTarget(cameraSceneNode:Object):Object

Returns the target of a camera scene node, the position where the camera looks at.

Parameters
cameraSceneNode:Object — Object representing a camera scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren(). If null, retrieves the target of the currently active camera.

Returns
Object — The object returned will have three members, .x, .y and .z and represent the relative target of the camera. Will return null if the scene node is not a camera.

See also

setCameraTarget
getCameraUpVector()method 
public function getCameraUpVector(cameraSceneNode:Object):Object

Returns the up vector of a camera scene node, the direction where 'up' is for the camera. The default value for this is (0,1,0).

Parameters
cameraSceneNode:Object — Object representing a camera scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren(). If null, retrieves the up vector of the currently active camera.

Returns
Object — The object returned will have three members, .x, .y and .z and represent the up vector target of the camera. Will return null if the scene node is not a camera.

See also

setCameraUpVector
getCollisionPointOfWorldWithLine()method 
public function getCollisionPointOfWorldWithLine(startX:Number, startY:Number, startZ:Number, endX:Number, endY:Number, endZ:Number):Object

Returns the collision point with a line and the world.

Parameters
startX:Number — X coordinate of the start point of the line.
 
startY:Number — Y coordinate of the start point of the line.
 
startZ:Number — Z coordinate of the start point of the line.
 
endX:Number — X coordinate of the end point of the line.
 
endY:Number — Y coordinate of the end point of the line.
 
endZ:Number — Z coordinate of the end point of the line.

Returns
Object — Returns an object with the members .x, .y and .z, representing the 3D position where the collision with the 3D world is. Returns null if there is no collision.
getCopperCubeVariable()method 
public function getCopperCubeVariable(varname:String):Object

Gets the value of a CopperCube variable. CopperCube variables can be changed and created in the editor using the variable actions, making it possible to interact with the behaviors.

Parameters
varname:String — Name of the variable

Returns
Object — Returns an object that is either a Number or a String
getFramesPerSecond()method 
public function getFramesPerSecond():int

Returns the current rendered frames per second value.

Returns
int — Returns the frames per second.
getLightColor()method 
public function getLightColor(lightSceneNode:Object):int

Returns the color of a light scene node.

Parameters
lightSceneNode:Object — Object representing a light scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
int — color of the light

See also

setLightColor
getLightRadius()method 
public function getLightRadius(lightSceneNode:Object):Number

Returns the radius of a light scene node.

Parameters
lightSceneNode:Object — Object representing a light scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
Number — Radius of the light

See also

setLightRadius
getMaterialLighting()method 
public function getMaterialLighting(scenenode:Object, materialIndex:int):Boolean

Returns if dynamic lighting is used for a material

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
materialIndex:int — Index of the material to be retrieved. Must be equal or bigger than 0 and smaller than getSceneNodeMaterialCount().

Returns
Boolean

See also

getSceneNodeMaterialCount
setMaterialLighting
getMaterialTexture()method 
public function getMaterialTexture(scenenode:Object, materialIndex:int):DisplayObject

Returns the texture of a scene node.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
materialIndex:int — Index of the material to be retrieved. Must be equal or bigger than 0 and smaller than getSceneNodeMaterialCount().

Returns
DisplayObject — A DisplayObject representing the texture of the material at the specified index. Usually, this is a Bitmap.

See also

getSceneNodeMaterialCount
setMaterialTexture
getMaterialType()method 
public function getMaterialType(scenenode:Object, materialIndex:int):String

Returns the type of a material of a scene node.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
materialIndex:int — Index of the material to be retrieved. Must be equal or bigger than 0 and smaller than getSceneNodeMaterialCount().

Returns
String — A string representing the material type. Possible values are "SOLID", "TRANSPARENT_ALPHA", "TRANSPARENT_ADD", "LIGHTMAP" and "LIGHTMAP_GOURAUD".

See also

getSceneNodeMaterialCount
setMaterialType
getSceneBackgroundColor()method 
public function getSceneBackgroundColor():int

Returns the current background color of the active 3D scene

Returns
int — value representing the color of the background.
getSceneNodeAbsolutePosition()method 
public function getSceneNodeAbsolutePosition(scenenode:Object):Object

Returns an object representing the absolute position of a scene node.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
Object — The object returned will have three members, .x, .y and .z and represent the absolute position of the scene node.
getSceneNodeBoundingBox()method 
public function getSceneNodeBoundingBox(scenenode:Object, transformed:Boolean):Object

Returns the bounding box of a scene node.

Parameters
scenenode:Object — object representing the scene node, can be retrieved for example using getSceneNodeByName().
 
transformed:Boolean — If set to true, returns the transformed bounding box instead of the untransformed one. Returning the transformed bounding box is slower, but the bounding box will be at the coordinates specified by the position, rotation an scale of the scene node.

Returns
Object — Returns an object representing the axis aligned bounding box of the scene node. The object will have the members .minX, .minY, .minZ, and .maxX, .maxY, .maxZ, where min is the minimal 3d point and max the maximal 3d point of the bounding box.
getSceneNodeByName()method 
public function getSceneNodeByName(name:String):Object

Returns an object representing a scene node wich has the specified name. All scene node access functions like for example setSceneNodePosition() take this object as first parameter.

Parameters
name:String — Name of the scene node to be found. Case sensitive.

Returns
Object — Representing the scene node with the specified name or null if not found.
getSceneNodeChildren()method 
public function getSceneNodeChildren(scenenode:Object):Array

Returns all scene node children of a parent scene node.

Parameters
scenenode:Object — object representing the parent scene node, can be retrieved for example using getSceneNodeByName(). Can also be null, in this case all top level scene nodes in the active scene are returned.

Returns
Array — Returns an array containing objects representing the wanted child scene nodes.
getSceneNodeMaterialCount()method 
public function getSceneNodeMaterialCount(scenenode:Object):int

Returns the amount of materials of a scene node. You can access and modify the material then using the setSceneNodMaterial.. functions.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
int — A value with the amount of different materials in the scene node.
getSceneNodeName()method 
public function getSceneNodeName(scenenode:Object):String

Returns the name of a scene node.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
String — Name of the scene node.
getSceneNodePosition()method 
public function getSceneNodePosition(scenenode:Object):Object

Returns an object representing the position of a scene node relative to its parent.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
Object — The object returned will have three members, .x, .y and .z and represent the relative position of the scene node.
getSceneNodeRotation()method 
public function getSceneNodeRotation(scenenode:Object):Object

Returns an object representing the rotation of a scene node relative to its parent.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
Object — The object returned will have three members, .x, .y and .z and represent the rotation of the scene node.
getSceneNodeScale()method 
public function getSceneNodeScale(scenenode:Object):Object

Returns an object representing the scale of a scene node relative to its parent.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
Object — The object returned will have three members, .x, .y and .z.
getSceneNodeType()method 
public function getSceneNodeType(scenenode:Object):String

Returns the type of a scene node.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
String — Returns a string representing the type of a scene node. The type can be "Camera", "Mesh", "Billboard", "Hotspot", "Skybox", "Light" and "Unknown".
getSceneNodeVisibility()method 
public function getSceneNodeVisibility(scenenode:Object):Boolean

Returns if the scene node is set to visible or to invisible.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().

Returns
Boolean — Returns true if the scene node is visible and false if not.
invalidate3DView()method 
public function invalidate3DView():void

Forces the view to be invalidated so it gets redrawn in the next frame.

isLoaded()method 
public function isLoaded():Boolean

Returns if the coppercube scene has been loaded. You can only use most other functions of this interface after this method returns true.

Returns
Boolean — true if the scene has been loaded and is ready to be used and false if not.
rebuildCollisionGeometry()method 
public function rebuildCollisionGeometry():void

Rebuilds the collision geometry for the current scene. This is useful for example when cloning or deleting scene nodes with the collision flag on.

setActiveCamera()method 
public function setActiveCamera(camera:Object):void

Sets the currently active camera scene node. The active camera is the camera where the scene is rendered from.

Parameters
camera:Object — Object representing a camera scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
setBillboardSize()method 
public function setBillboardSize(billboardSceneNode:Object, w:Number, h:Number):void

Sets the size of a billBoard scene node.

Parameters
billboardSceneNode:Object — Object representing a billboard scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
w:Number — new width of the billboard
 
h:Number — new height of the billboard

See also

getBillboardSize
setCameraAspectRatio()method 
public function setCameraAspectRatio(cameraSceneNode:Object, aspectRatio:Number):void

Sets the aspect ratio of the camera.

Parameters
cameraSceneNode:Object — Object representing a camera scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren(). If null, uses the currently active camera.
 
aspectRatio:Number — New aspect ratio of the camera. To have a ratio of 16:9 for example, call setCameraAspectRatio(yourNode, 16.0 / 9.0);

See also

getCameraAspectRatio
setCameraFieldOfView()method 
public function setCameraFieldOfView(cameraSceneNode:Object, fieldOfView:Number):void

Sets the field of view (or also known as zoom) of the camera.

Parameters
cameraSceneNode:Object — Object representing a camera scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren(). If null, uses the currently active camera.
 
fieldOfView:Number — New field of view of the camera, in degrees. Use 60, for example to have a field of view of 60 degrees.

See also

getCameraFieldOfView
setCameraTarget()method 
public function setCameraTarget(cameraSceneNode:Object, x:Number, y:Number, z:Number):void

Sets the look-at target position of a camera scene node.

Parameters
cameraSceneNode:Object — Object representing a camera scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren(). If null, sets the target of the currently active camera.
 
x:Number — X coordinate of the new target.
 
y:Number — Y coordinate of the new target.
 
z:Number — Z coordinate of the new target.

See also

getCameraTarget
setCameraUpVector()method 
public function setCameraUpVector(cameraSceneNode:Object, x:Number, y:Number, z:Number):void

Sets the up vector of a camera scene node, a vector pointing to where 'up' is. The default value for this is (0,1,0).

Parameters
cameraSceneNode:Object — Object representing a camera scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren(). If null, sets the up vector of the currently active camera.
 
x:Number — X coordinate of the new up vector.
 
y:Number — Y coordinate of the new up vector.
 
z:Number — Z coordinate of the new up vector.

See also

getCameraUpVector
setCopperCubeVariable()method 
public function setCopperCubeVariable(varname:String, value:Object):void

Sets the value of a CopperCube variable. CopperCube variables can be changed and created in the editor using the variable actions, making it possible to interact with the behaviors.

Parameters
varname:String — Name of the variable
 
value:Object — Object representing the new value. Should be a String or a Number.
setLightColor()method 
public function setLightColor(lightSceneNode:Object, color:int):void

Sets the radius of a light scene node.

Parameters
lightSceneNode:Object — Object representing a light scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
color:int — Radius of the light

See also

getLightColor
setLightRadius()method 
public function setLightRadius(lightSceneNode:Object, radius:Number):void

Sets the radius of a light scene node.

Parameters
lightSceneNode:Object — Object representing a light scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
radius:Number — Radius of the light

See also

setLightRadius
setMaterialLighting()method 
public function setMaterialLighting(scenenode:Object, materialIndex:int, dynamicLighting:Boolean):void

Sets the dynamic lighting flag of the material

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
materialIndex:int — Index of the material to be retrieved. Must be equal or bigger than 0 and smaller than getSceneNodeMaterialCount().
 
dynamicLighting:Boolean — A flag specifying of dynamic lighting should be used for this material or not.

See also

getSceneNodeMaterialCount
getMaterialLighting
setMaterialTexture()method 
public function setMaterialTexture(scenenode:Object, materialIndex:int, texture:DisplayObject):void

Sets the texture of a scene node.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
materialIndex:int — Index of the material to changed. Must be equal or bigger than 0 and smaller than getSceneNodeMaterialCount().
 
texture:DisplayObject

See also

getSceneNodeMaterialCount
getMaterialTexture
setMaterialType()method 
public function setMaterialType(scenenode:Object, materialIndex:int, newMaterialType:String):void

Returns the type of a material of a scene node.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
materialIndex:int — Index of the material to be retrieved. Must be equal or bigger than 0 and smaller than getSceneNodeMaterialCount().
 
newMaterialType:String — A string representing the new material type. Possible values are "SOLID", "TRANSPARENT_ALPHA", "TRANSPARENT_ADD", "LIGHTMAP" and "LIGHTMAP_GOURAUD".

See also

getSceneNodeMaterialCount
getMaterialType
setSceneBackgroundColor()method 
public function setSceneBackgroundColor(clr:int):void

Sets the current background color of the active 3D scene

Parameters
clr:int
setSceneNodeAnimation()method 
public function setSceneNodeAnimation(scenenode:Object, animationName:String):void

Sets the animation of an animated mesh scene node. If the scene node is not an animated mesh this function has no effect.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
animationName:String — Name of the animation, as set in the animation editor, for example "run" or "attack". Can also be "All" for playing all animations or "None" for playing none.
setSceneNodeAnimationLoop()method 
public function setSceneNodeAnimationLoop(scenenode:Object, loop:Boolean):void

Sets the animation loop mode of an animated mesh scene node. If the scene node is not an animated mesh this function has no effect.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
loop:Boolean — True if the current animation should be played looped, false if not.
setSceneNodeAnimationSpeed()method 
public function setSceneNodeAnimationSpeed(scenenode:Object, framesPerSecond:Number):void

Sets the animation speed of an animated mesh scene node. If the scene node is not an animated mesh this function has no effect.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
framesPerSecond:Number — Animation speed. Usually a value like 10.0
setSceneNodeName()method 
public function setSceneNodeName(scenenode:Object, name:String):void

Sets the name of a scene node.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
name:String
setSceneNodeParent()method 
public function setSceneNodeParent(scenenode:Object, parent:Object):void

Sets the parent of a scene node. Only works if the parent of the scene node is not a child of the scene node.

Parameters
scenenode:Object — Object representing a scene node which will get the new parent, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
parent:Object — Object representing a scene node which will be the new parent, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
setSceneNodePosition()method 
public function setSceneNodePosition(scenenode:Object, x:Number, y:Number, z:Number):void

Sets the position of a scene node, relative to its parent. If the scene node has no parent, this is the absolute position.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
x:Number
 
y:Number
 
z:Number

See also

getSceneNodeAbsolutePosition
setSceneNodePositionWithoutCollision()method 
public function setSceneNodePositionWithoutCollision(scenenode:Object, x:Number, y:Number, z:Number):void

Sets a new position of a scene node, even if the scene node has a 'collide with walls' behavior attached to it. So it it possible to move such a scene node through walls. Note that you have to ensure that the new position of the scene node is not inside a wall, otherwise the node will be stuck.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
x:Number — X coordinate of the new position.
 
y:Number — Y coordinate of the new position.
 
z:Number — Z coordinate of the new position.
setSceneNodeRotation()method 
public function setSceneNodeRotation(scenenode:Object, x:Number, y:Number, z:Number):void

Sets the rotation of a scene node, relative to its parent. If the scene node has no parent, this is the absolute rotation.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
x:Number
 
y:Number
 
z:Number
setSceneNodeRotationToLookAt()method 
public function setSceneNodeRotationToLookAt(scenenode:Object, x:Number, y:Number, z:Number):void

Sets the rotation of a scene node to point to a specific position. Don't use this for cameras, use setCameraTarget instead.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
x:Number — X coordinate of the position where the node should look at.
 
y:Number — Y coordinate of the position where the node should look at.
 
z:Number — Z coordinate of the position where the node should look at.
setSceneNodeScale()method 
public function setSceneNodeScale(scenenode:Object, x:Number, y:Number, z:Number):void

Sets the scale of a scene node, relative to its parent. If the scene node has no parent, this is the absolute rotation.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
x:Number
 
y:Number
 
z:Number
setSceneNodeVisibility()method 
public function setSceneNodeVisibility(scenenode:Object, visible:Boolean):void

Sets the visibility of a scene node.

Parameters
scenenode:Object — Object representing a scene node, can be retrieved for example using getSceneNodeByName() or getSceneNodeChildren().
 
visible:Boolean
switchToScene()method 
public function switchToScene(name:String):Boolean

Switches the another scene

Parameters
name:String — Name of the scene to switch to.

Returns
Boolean — Returns true if successful.