Packageflare.core
Classpublic dynamic class Canvas3D
InheritanceCanvas3D Inheritance Object

The Canvas3D class is used to store and render polygons in each 'render' event of the scene.



Public Properties
 PropertyDefined By
  centerX : Number
[read-only] Returns the canvas center on the x axis.
Canvas3D
  centerY : Number
[read-only] Returns the canvas center on the Y axis.
Canvas3D
  container : Sprite
[read-only] Returns the container in which rendering is performed.
Canvas3D
  graphics : Graphics
Refers to the Graphics object that is used for rendering.
Canvas3D
  height : Number
[read-only] Returns the canvas height.
Canvas3D
  numLayers : int
[read-only] Returns the number of layers that have been used in the last render.
Canvas3D
  polysRendered : int
[read-only] Returns the number of objects that were rendered by the canvas.
Canvas3D
  showMenu : Boolean
[write-only] Show or hide About Flare3D contextual menu.
Canvas3D
  sortFunction : Function
Canvas3D
  useMask : Boolean
Returns or sets whether a mask will be used to crop the canvas edges.
Canvas3D
  width : Number
[read-only] Returns the canvas width.
Canvas3D
  x : Number
[read-only] Returns the canvas position on the x axis.
Canvas3D
  y : Number
[read-only] Returns the canvas position on the y axis.
Canvas3D
Public Methods
 MethodDefined By
  
Canvas3D(container:Sprite, width:int = 640, height:int = 480)
Creates a new Canvas3D.
Canvas3D
  
addLayer(layer:Shape):void
Adds a new layer.
Canvas3D
  
clear():void
Clears the canvas.
Canvas3D
  
createLayer():Shape
Creates a new layer.
Canvas3D
  
dispose():void
Eliminates the object and releases the associated resources.
Canvas3D
  
flip():void
Flips all the polygons prepared for rendering.
Canvas3D
  
setResolution(width:int, height:int):void
Sets canvas resolution.
Canvas3D
  
setViewport(width:int, height:int, x:int = 0, y:int = 0):void
Sets the dimensions of the canvas rendering area.
Canvas3D
Property Detail
centerXproperty
centerX:Number  [read-only]

Returns the canvas center on the x axis.


Implementation
    public function get centerX():Number

See also

centerYproperty 
centerY:Number  [read-only]

Returns the canvas center on the Y axis.


Implementation
    public function get centerY():Number

See also

containerproperty 
container:Sprite  [read-only]

Returns the container in which rendering is performed.


Implementation
    public function get container():Sprite
graphicsproperty 
public var graphics:Graphics

Refers to the Graphics object that is used for rendering. Materials will have to access this object to render on the corresponding layer.

See also

heightproperty 
height:Number  [read-only]

Returns the canvas height.


Implementation
    public function get height():Number

See also

numLayersproperty 
numLayers:int  [read-only]

Returns the number of layers that have been used in the last render. Layers are used by materials either to make use alpha or blending or in complex materials such as MultiMaterial. This value is only meant for statistical purposes.


Implementation
    public function get numLayers():int

See also

polysRenderedproperty 
polysRendered:int  [read-only]

Returns the number of objects that were rendered by the canvas.


Implementation
    public function get polysRendered():int
showMenuproperty 
showMenu:Boolean  [write-only]

Show or hide About Flare3D contextual menu.


Implementation
    public function set showMenu(value:Boolean):void
sortFunctionproperty 
sortFunction:Function


Implementation
    public function get sortFunction():Function
    public function set sortFunction(value:Function):void
useMaskproperty 
useMask:Boolean

Returns or sets whether a mask will be used to crop the canvas edges. The default value is true.


Implementation
    public function get useMask():Boolean
    public function set useMask(value:Boolean):void

See also

widthproperty 
width:Number  [read-only]

Returns the canvas width.


Implementation
    public function get width():Number

See also

xproperty 
x:Number  [read-only]

Returns the canvas position on the x axis.


Implementation
    public function get x():Number

See also

yproperty 
y:Number  [read-only]

Returns the canvas position on the y axis.


Implementation
    public function get y():Number

See also

Constructor Detail
Canvas3D()Constructor
public function Canvas3D(container:Sprite, width:int = 640, height:int = 480)

Creates a new Canvas3D.

Parameters
container:Sprite — Container in which rendering will be performed.
 
width:int (default = 640) — Canvas width in pixels.
 
height:int (default = 480) — Canvas height in pixels.
Method Detail
addLayer()method
public function addLayer(layer:Shape):void

Adds a new layer. This method is usually used by materials to make use of alpha or blending.

Parameters

layer:Shape — Refers to the layer to be added.

clear()method 
public function clear():void

Clears the canvas.

createLayer()method 
public function createLayer():Shape

Creates a new layer. This method is usually used by materials to make use of alpha or blending.

Returns
Shape — Returns the crated layer.
dispose()method 
public function dispose():void

Eliminates the object and releases the associated resources. Once eliminated, it cannot be accessed again.

flip()method 
public function flip():void

Flips all the polygons prepared for rendering.

setResolution()method 
public function setResolution(width:int, height:int):void

Sets canvas resolution. The canvas can have lower resolution than its own size in order to accelerate rendering processes. This will result in faster performance but lower quality. It can make a significant contribution, though, in less powerful machines where high speeds are required in real time. Resolution can be modified at any time without affecting the other scene components.

Parameters

width:int — Width in pixels that will be used. Its value cannot be higher the canvas width.
 
height:int — Height in pixels that will be used. Its value cannot be higher than canvas height.

See also

setViewport()method 
public function setViewport(width:int, height:int, x:int = 0, y:int = 0):void

Sets the dimensions of the canvas rendering area.

Parameters

width:int — Canvas width
 
height:int — Canvas height.
 
x:int (default = 0)
 
y:int (default = 0)

See also