Packageorg.papervision3d.objects
Classpublic class DisplayObject3D
InheritanceDisplayObject3D Inheritance DisplayObjectContainer3D Inheritance flash.events.EventDispatcher
SubclassesCameraObject3D, Collada, Vertices3D

The DisplayObject class represents instances of 3D objects that are contained in the scene.

That includes all objects in the scene, not only those that can be rendered, but also the camera and its target.

The DisplayObject3D class supports basic functionality like the x, y and z position of an object, as well as rotationX, rotationY, rotationZ, scaleX, scaleY and scaleZ and visible. It also supports more advanced properties of the object such as its transform Matrix3D.

DisplayObject3D is not an abstract base class; therefore, you can call DisplayObject3D directly. Invoking new DisplayObject() creates a new empty object in 3D space, like when you used createEmptyMovieClip().



Public Properties
 PropertyDefined by
 Inheritedchildren : Object
Returns the children object.
DisplayObjectContainer3D
  container : Sprite
The Sprite that you draw into when rendering in a MovieScene3D.
DisplayObject3D
  extra : Object
An object that contains user defined properties.
DisplayObject3D
  faces : Array
[internal-use]
DisplayObject3D
  geometry : GeometryObject3D
The GeometryObject3D object that contains the 3D definition of this instance.
DisplayObject3D
  id : int
[read-only] Unique id of this instance.
DisplayObject3D
  material : MaterialObject3D
The default material for the object instance.
DisplayObject3D
  materials : MaterialsList
The list of materials for this instance.
DisplayObject3D
  name : String
An optional object name.
DisplayObject3D
 InheritednumChildren : int
Returns the number of children of this object.
DisplayObjectContainer3D
  parent : DisplayObjectContainer3D
[read-only] Indicates the DisplayObjectContainer3D object that contains this display object.
DisplayObject3D
  projected : Dictionary
[internal-use]
DisplayObject3D
 Inheritedroot : DisplayObjectContainer3D
[read-only] [read-only] The scene, which is the top-most displayObjectContainer3D in the tree structure.
DisplayObjectContainer3D
  rotationX : Number
Specifies the rotation around the X axis from its original orientation.
DisplayObject3D
  rotationY : Number
Specifies the rotation around the Y axis from its original orientation.
DisplayObject3D
  rotationZ : Number
Specifies the rotation around the Z axis from its original orientation.
DisplayObject3D
  scale : Number
[write-only] Sets the 3D scale as applied from the registration point of the object.
DisplayObject3D
  scaleX : Number
[write-only] Sets the scale along the local X axis as applied from the registration point of the object.
DisplayObject3D
  scaleY : Number
[write-only] Sets the scale along the local Y axis as applied from the registration point of the object.
DisplayObject3D
  scaleZ : Number
[write-only] Sets the scale along the local Z axis as applied from the registration point of the object.
DisplayObject3D
  scene : SceneObject3D
The scene where the object belongs.
DisplayObject3D
  screenZ : Number
[internal-use] The depth (z coordinate) of the transformed object's center.
DisplayObject3D
  transform : Matrix3D
A Matrix3D object containing values that affect the scaling, rotation, and translation of the display object.
DisplayObject3D
  view : Matrix3D
[internal-use] A camera transformed Matrix3D object.
DisplayObject3D
  visible : Boolean
Whether or not the display object is visible.
DisplayObject3D
  x : Number
An Number that sets the X coordinate of a object relative to the scene coordinate system.
DisplayObject3D
  y : Number
An Number that sets the Y coordinate of a object relative to the scene coordinates.
DisplayObject3D
  z : Number
An Number that sets the Z coordinate of a object relative to the scene coordinates.
DisplayObject3D
  ZERO : DisplayObject3D
[static][read-only] Returns an empty DiplayObject3D object positioned in the center of the 3D coordinate system (0, 0 ,0).
DisplayObject3D
Protected Properties
 PropertyDefined by
 Inherited_children : Dictionary
[internal-use] Names indexed by children.
DisplayObjectContainer3D
 Inherited_childrenByName : Object
[internal-use] Children indexed by name.
DisplayObjectContainer3D
  _sorted : Array
DisplayObject3D
  _transformDirty : Boolean = false
[internal-use]
DisplayObject3D
Public Methods
 MethodDefined by
  
DisplayObject3D(name:String = null, geometry:GeometryObject3D = null, initObject:Object = null)
Creates a new DisplayObject3D instance.
DisplayObject3D
 Inherited
addChild(child:DisplayObject3D, name:String = null):DisplayObject3D
Adds a child DisplayObject3D instance to this DisplayObjectContainer instance.
DisplayObjectContainer3D
 Inherited
Adds all the children of a DisplayObject3D instance to this DisplayObjectContainer instance.
DisplayObjectContainer3D
 Inherited
addCollada(filename:String, materials:MaterialsList = null, scale:Number = 1):void
This method has been deprecated.
DisplayObjectContainer3D
  
addGeometry(geometry:GeometryObject3D = null):void
Adds a geometry definition to the instance.
DisplayObject3D
 Inherited
childrenList():String
Returns a string value with the list of objects.
DisplayObjectContainer3D
  
copyPosition(reference:*):void
Copies the position information (x, y and z coordinates) from another object or Matrix3D.
DisplayObject3D
  
copyTransform(reference:*):void
Copies the transformation information (position, rotation and scale) from another object or Matrix3D.
DisplayObject3D
  
Gets the distance to the position of the given object.
DisplayObject3D
 Inherited
Returns the child display object that exists with the specified name.
DisplayObjectContainer3D
  
Returns the material that exists with the specified name in the materials list.
DisplayObject3D
  
hitTestObject(obj:DisplayObject3D, multiplier:Number = 1):Boolean
Evaluates the display object to see if it overlaps or intersects with the obj display object.
DisplayObject3D
  
hitTestPoint(x:Number, y:Number, z:Number):Boolean
Evaluates the display object to see if it overlaps or intersects with the point specified by the x, y and z parameters.
DisplayObject3D
  
lookAt(targetObject:DisplayObject3D, upAxis:Number3D = null):void
Make the object look at a specific position.
DisplayObject3D
  
materialsList():String
Returns a string value with the list of material names of the materials list.
DisplayObject3D
  
moveBackward(distance:Number):void
Translate the display object in the opposite direction it is facing, i.e.
DisplayObject3D
  
moveDown(distance:Number):void
Translate the display object downwards, with respect to the direction it is facing, i.e.
DisplayObject3D
  
moveForward(distance:Number):void
Translate the display object in the direction it is facing, i.e.
DisplayObject3D
  
moveLeft(distance:Number):void
Translate the display object lateraly, to the left of the direction it is facing, i.e.
DisplayObject3D
  
moveRight(distance:Number):void
Translate the display object lateraly, to the right of the direction it is facing, i.e.
DisplayObject3D
  
moveUp(distance:Number):void
Translate the display object upwards, with respect to the direction it is facing, i.e.
DisplayObject3D
  
pitch(angle:Number):void
Rotate the display object around its lateral or transverse axis —an axis running from the pilot's left to right in piloted aircraft, and parallel to the wings of a winged aircraft; thus the nose pitches up and the tail down, or vice-versa.
DisplayObject3D
  
project(parent:DisplayObject3D, camera:CameraObject3D, sorted:Array = null):Number
[internal-use] Projects three dimensional coordinates onto a two dimensional plane to simulate the relationship of the camera to subject.
DisplayObject3D
 Inherited
Removes the specified child DisplayObject3D instance from the child list of the DisplayObjectContainer3D instance.
DisplayObjectContainer3D
 Inherited
Removes the child DisplayObject3D instance that exists with the specified name, from the child list of the DisplayObjectContainer3D instance.
DisplayObjectContainer3D
  
render(scene:SceneObject3D):void
[internal-use] Render the projected object.
DisplayObject3D
  
roll(angle:Number):void
Rotate the display object around the longitudinal axis —an axis drawn through the body of the vehicle from tail to nose in the normal direction of flight, or the direction the object is facing.
DisplayObject3D
  
toString():String
Returns a string value representing the three-dimensional position values of the display object instance.
DisplayObject3D
  
translate(distance:Number, axis:Number3D):void
Move the object along a given direction.
DisplayObject3D
  
yaw(angle:Number):void
Rotate the display object around about the vertical axis —an axis drawn from top to bottom.
DisplayObject3D
Protected Methods
 MethodDefined by
  
[internal-use] Updates the transform Matrix3D with the current rotation and scale values.
DisplayObject3D
Property detail
containerproperty
public var container:Sprite

The Sprite that you draw into when rendering in a MovieScene3D. While Scene3D uses a single Sprite container for all the objects, MovieScene3D renders each object in its own unique Sprite. You can use the container like any other Sprite. For example, you can add events to it, apply filters or change the blend mode.

extraproperty 
public var extra:Object

An object that contains user defined properties.

All properties of the extra field are copied into the new instance. The properties specified with extra are publicly available.

facesproperty 
public var faces:Array

[internal-use]

geometryproperty 
public var geometry:GeometryObject3D

The GeometryObject3D object that contains the 3D definition of this instance.

When different objects share the same geometry, they become instances. They are the same object, displayed multiple times. Changing the shape of this object changes the shape of all of its instances.

Instancing an object saves system memory, and is useful to display an object multiple times while maintaining its shape.

For example, you could create armies and forests full of duplicate objects without needing the memory to handle that much actual geometry. Each instance has its own transform node so it can have its own position, rotation, and scaling.

idproperty 
public var id:int

[read-only] Unique id of this instance.

materialproperty 
public var material:MaterialObject3D

The default material for the object instance. Materials collect data about how objects appear when rendered.

materialsproperty 
public var materials:MaterialsList

The list of materials for this instance.

nameproperty 
public var name:String

An optional object name.

parentproperty 
public var parent:DisplayObjectContainer3D

[read-only] Indicates the DisplayObjectContainer3D object that contains this display object.

projectedproperty 
public var projected:Dictionary

[internal-use]

rotationXproperty 
rotationX:Number  [read-write]

Specifies the rotation around the X axis from its original orientation.

Implementation
    public function get rotationX():Number
    public function set rotationX(value:Number):void
rotationYproperty 
rotationY:Number  [read-write]

Specifies the rotation around the Y axis from its original orientation.

Implementation
    public function get rotationY():Number
    public function set rotationY(value:Number):void
rotationZproperty 
rotationZ:Number  [read-write]

Specifies the rotation around the Z axis from its original orientation.

Implementation
    public function get rotationZ():Number
    public function set rotationZ(value:Number):void
scaleproperty 
scale:Number  [write-only]

Sets the 3D scale as applied from the registration point of the object.

Implementation
    public function set scale(value:Number):void
scaleXproperty 
scaleX:Number  [write-only]

Sets the scale along the local X axis as applied from the registration point of the object.

Implementation
    public function set scaleX(value:Number):void
scaleYproperty 
scaleY:Number  [write-only]

Sets the scale along the local Y axis as applied from the registration point of the object.

Implementation
    public function set scaleY(value:Number):void
scaleZproperty 
scaleZ:Number  [write-only]

Sets the scale along the local Z axis as applied from the registration point of the object.

Implementation
    public function set scaleZ(value:Number):void
sceneproperty 
public var scene:SceneObject3D

The scene where the object belongs.

screenZproperty 
public var screenZ:Number

[internal-use] The depth (z coordinate) of the transformed object's center. Also known as the distance from the camera. Used internally for z-sorting.

_sortedproperty 
protected var _sorted:Array
transformproperty 
public var transform:Matrix3D

A Matrix3D object containing values that affect the scaling, rotation, and translation of the display object.

_transformDirtyproperty 
protected var _transformDirty:Boolean = false

[internal-use]

viewproperty 
public var view:Matrix3D

[internal-use] A camera transformed Matrix3D object.

visibleproperty 
public var visible:Boolean

Whether or not the display object is visible.

A Boolean value that indicates whether the object is projected, transformed and rendered. A value of false will effectively ignore the object. The default value is true.

xproperty 
x:Number  [read-write]

An Number that sets the X coordinate of a object relative to the scene coordinate system.

Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number  [read-write]

An Number that sets the Y coordinate of a object relative to the scene coordinates.

Implementation
    public function get y():Number
    public function set y(value:Number):void
zproperty 
z:Number  [read-write]

An Number that sets the Z coordinate of a object relative to the scene coordinates.

Implementation
    public function get z():Number
    public function set z(value:Number):void
ZEROproperty 
ZERO:DisplayObject3D  [read-only]

Returns an empty DiplayObject3D object positioned in the center of the 3D coordinate system (0, 0 ,0).

Implementation
    public static function get ZERO():DisplayObject3D
Constructor detail
DisplayObject3D()constructor
public function DisplayObject3D(name:String = null, geometry:GeometryObject3D = null, initObject:Object = null)

Creates a new DisplayObject3D instance. After creating the instance, call the addChild() method of a DisplayObjectContainer3D.

Parameters
name:String (default = null) — [optional] - The name of the newly created object.
 
geometry:GeometryObject3D (default = null) — [optional] - The geometry of the newly created object.
 
initObject:Object (default = null) — [optional] - An object that contains user defined properties with which to populate the newly created DisplayObject3D.
  • x: An Number that sets the X coordinate of a object relative to the scene coordinate system.
  • y: An Number that sets the Y coordinate of a object relative to the scene coordinate system.
  • z: An Number that sets the Z coordinate of a object relative to the scene coordinate system.
  • rotationX: Specifies the rotation around the X axis from its original orientation.
  • rotationY: Specifies the rotation around the Y axis from its original orientation.
  • rotationZ: Specifies the rotation around the Z axis from its original orientation.
  • scaleX: Sets the scale along the local X axis as applied from the registration point of the object.
  • scaleY: Sets the scale along the local Y axis as applied from the registration point of the object.
  • scaleZ: Sets the scale along the local Z axis as applied from the registration point of the object.
  • visible: Whether or not the display object is visible.

    A Boolean value that indicates whether the object is projected, transformed and rendered. A value of false will effectively ignore the object. The default value is true.

  • container: The MovieClip that you draw into when rendering. Use only when the object is rendered in its own unique MovieClip.

    It's Boolean value determines whether the container MovieClip should be cleared before rendering.

  • extra: An object that contains user defined properties.

    All properties of the extra field are copied into the new instance. The properties specified with extra are publicly available.

Method detail
addGeometry()method
public function addGeometry(geometry:GeometryObject3D = null):void

Adds a geometry definition to the instance. A geometry describes the visual shape and appearance of an object in a scene.

Parameters
geometry:GeometryObject3D (default = null) — A geometry definition.
copyPosition()method 
public function copyPosition(reference:*):void

Copies the position information (x, y and z coordinates) from another object or Matrix3D.

Parameters
reference:* — A DisplayObject3D or Matrix3D object to copy the position from.
copyTransform()method 
public function copyTransform(reference:*):void

Copies the transformation information (position, rotation and scale) from another object or Matrix3D.

Parameters
reference:* — A DisplayObject3D or Matrix3D object to copy the position from.
distanceTo()method 
public function distanceTo(obj:DisplayObject3D):Number

Gets the distance to the position of the given object.

Parameters
obj:DisplayObject3D — The display object to measure the distance to.

Returns
Number — The distance to the registration point of the given object.
getMaterialByName()method 
public function getMaterialByName(name:String):MaterialObject3D

Returns the material that exists with the specified name in the materials list.

If more that one material object has the specified name, the method returns the first material object in the materials list.

Parameters
name:String — The name of the material to return.

Returns
MaterialObject3D — The material object with the specified name.
hitTestObject()method 
public function hitTestObject(obj:DisplayObject3D, multiplier:Number = 1):Boolean

Evaluates the display object to see if it overlaps or intersects with the obj display object.

Parameters
obj:DisplayObject3D — The display object to test against.
 
multiplier:Number (default = 1)

Returns
Boolean — true if the display objects intersect; false if not.
hitTestPoint()method 
public function hitTestPoint(x:Number, y:Number, z:Number):Boolean

Evaluates the display object to see if it overlaps or intersects with the point specified by the x, y and z parameters.

The x, y and z parameters specify a point in the coordinate space of the instance parent object, not the scene (unless that parent object is the scene).

Parameters
x:Number — The x coordinate to test against this object.
 
y:Number — The y coordinate to test against this object.
 
z:Number — The z coordinate to test against this object.

Returns
Boolean — true if the display object overlaps or intersects with the specified point; false otherwise.
lookAt()method 
public function lookAt(targetObject:DisplayObject3D, upAxis:Number3D = null):void

Make the object look at a specific position.

Parameters
targetObject:DisplayObject3D — Object to look at.
 
upAxis:Number3D (default = null) — The vertical axis of the universe. Normally the positive Y axis.
materialsList()method 
public function materialsList():String

Returns a string value with the list of material names of the materials list.

Returns
String — A string.
moveBackward()method 
public function moveBackward(distance:Number):void

Translate the display object in the opposite direction it is facing, i.e. it's negative Z axis.

Parameters
distance:Number — The distance that the object should move backward.
moveDown()method 
public function moveDown(distance:Number):void

Translate the display object downwards, with respect to the direction it is facing, i.e. it's negative Y axis.

Parameters
distance:Number — The distance that the object should move down.
moveForward()method 
public function moveForward(distance:Number):void

Translate the display object in the direction it is facing, i.e. it's positive Z axis.

Parameters
distance:Number — The distance that the object should move forward.
moveLeft()method 
public function moveLeft(distance:Number):void

Translate the display object lateraly, to the left of the direction it is facing, i.e. it's negative X axis.

Parameters
distance:Number — The distance that the object should move left.
moveRight()method 
public function moveRight(distance:Number):void

Translate the display object lateraly, to the right of the direction it is facing, i.e. it's positive X axis.

Parameters
distance:Number — The distance that the object should move right.
moveUp()method 
public function moveUp(distance:Number):void

Translate the display object upwards, with respect to the direction it is facing, i.e. it's positive Y axis.

Parameters
distance:Number — The distance that the object should move up.
pitch()method 
public function pitch(angle:Number):void

Rotate the display object around its lateral or transverse axis —an axis running from the pilot's left to right in piloted aircraft, and parallel to the wings of a winged aircraft; thus the nose pitches up and the tail down, or vice-versa.

Parameters
angle:Number — The angle to rotate.
project()method 
public function project(parent:DisplayObject3D, camera:CameraObject3D, sorted:Array = null):Number

[internal-use] Projects three dimensional coordinates onto a two dimensional plane to simulate the relationship of the camera to subject.

This is the first step in the process of representing three dimensional shapes two dimensionally.

Parameters
parent:DisplayObject3D — The DisplayObject3D object that contains this display object.
 
camera:CameraObject3D — Camera3D object to render from.
 
sorted:Array (default = null) — The list of faces of the current sort branch.

Returns
Number
render()method 
public function render(scene:SceneObject3D):void

[internal-use] Render the projected object.

Parameters
scene:SceneObject3D — The scene where the object belongs.
roll()method 
public function roll(angle:Number):void

Rotate the display object around the longitudinal axis —an axis drawn through the body of the vehicle from tail to nose in the normal direction of flight, or the direction the object is facing.

Parameters
angle:Number
toString()method 
public override function toString():String

Returns a string value representing the three-dimensional position values of the display object instance.

Returns
String — A string.
translate()method 
public function translate(distance:Number, axis:Number3D):void

Move the object along a given direction.

Parameters
distance:Number — The distance that the object should travel.
 
axis:Number3D — The direction that the object should move towards.
updateTransform()method 
protected function updateTransform():void

[internal-use] Updates the transform Matrix3D with the current rotation and scale values.

yaw()method 
public function yaw(angle:Number):void

Rotate the display object around about the vertical axis —an axis drawn from top to bottom.

Parameters
angle:Number — The angle to rotate.