| Package | away3d.containers |
| Class | public class View3D |
| Inheritance | View3D flash.display.Sprite |
| Property | Defined by | ||
|---|---|---|---|
| background : Sprite
A background sprite positioned under the rendered scene.
| View3D | ||
| blockerarray : BlockerArray | View3D | ||
| blockers : Dictionary | View3D | ||
| camera : Camera3D
Camera used when rendering.
| View3D | ||
| cameraVarsStore : CameraVarsStore
[read-only]
| View3D | ||
| clipping : Clipping
Clipping area used when rendering.
| View3D | ||
| drawPrimitiveStore : DrawPrimitiveStore
[read-only]
| View3D | ||
| forceUpdate : Boolean
Defines whether the view always redraws on a render, or just redraws what 3d objects change.
| View3D | ||
| hud : Sprite
A container for 2D overlays positioned over the rendered scene.
| View3D | ||
| mouseEvents : Boolean
Enables/Disables mouse interactivity.
| View3D | ||
| mouseMaterial : IUVMaterial
Current material under the mouse.
| View3D | ||
| mouseObject : Object3D
Current object under the mouse.
| View3D | ||
| mouseZeroMove : Boolean
Forces mousemove events to fire even when cursor is static.
| View3D | ||
| overlay : Sprite
An overlay sprite positioned on top of the rendered scene.
| View3D | ||
| renderer : IRenderer
Renderer object used to traverse the scenegraph and output the drawing primitives required to render the scene to the view.
| View3D | ||
| scene : Scene3D
Scene used when rendering.
| View3D | ||
| screenClipping : Clipping
[read-only]
| View3D | ||
| session : AbstractRenderSession
Session object used to draw all drawing primitives returned from the renderer to the view container.
| View3D | ||
| sourceURL : String
Optional string for storing source url.
| View3D | ||
| stats : Boolean
Enables/Disables stats panel.
| View3D | ||
| statsOpen : Boolean
Keeps track of whether the stats panel is currently open.
| View3D | ||
| statsPanel : Stats
Object instance of the stats panel.
| View3D | ||
| updated : Boolean [read-only]
Flag used to determine if the camera has updated the view.
| View3D | ||
| Method | Defined by | ||
|---|---|---|---|
|
View3D
(init:Object = null)
Creates a new
View3D object. | View3D | ||
|
addOnMouseDown(listener:Function):void
Default method for adding a mouseDown3d event listener.
| View3D | ||
|
addOnMouseMove(listener:Function):void
Default method for adding a mouseMove3d event listener.
| View3D | ||
|
addOnMouseOut(listener:Function):void
Default method for adding a 3d mouseOut event listener.
| View3D | ||
|
addOnMouseOver(listener:Function):void
Default method for adding a 3d mouseOver event listener.
| View3D | ||
|
addOnMouseUp(listener:Function):void
Default method for adding a mouseUp3d event listener.
| View3D | ||
|
Adds an overlay effect on top of the view container.
| View3D | ||
|
addSourceURL(url:String):void
Defines a source url string that can be accessed though a View Source option in the right-click menu.
| View3D | ||
|
clear():void
Clears previously rendered view from all render sessions.
| View3D | ||
|
Finds the object that is rendered under a certain view coordinate.
| View3D | ||
|
fireMouseEvent(type:String, x:Number, y:Number, ctrlKey:Boolean = false, shiftKey:Boolean = false):void
Collects all information from the given type of 3d mouse event into a
MouseEvent3D object that can be accessed from the getMouseEvent() | View3D | ||
|
fireMouseMoveEvent(force:Boolean = false):void
Manually fires a mouseMove3D event.
| View3D | ||
|
getBitmapData():BitmapData
Returns the
bitmapData of the rendered scene. | View3D | ||
|
getContainer():DisplayObject
Returns the
DisplayObject container of the rendered scene. | View3D | ||
|
Returns a 3d mouse event object populated with the properties from the hit point.
| View3D | ||
|
removeOnMouseDown(listener:Function):void
Default method for removing a mouseDown3d event listener.
| View3D | ||
|
removeOnMouseMove(listener:Function):void
Default method for removing a mouseMove3D event listener.
| View3D | ||
|
removeOnMouseOut(listener:Function):void
Default method for removing a 3d mouseOut event listener.
| View3D | ||
|
removeOnMouseOver(listener:Function):void
Default method for removing a 3d mouseOver event listener.
| View3D | ||
|
removeOnMouseUp(listener:Function):void
Default method for removing a 3d mouseUp event listener.
| View3D | ||
|
Removes an overlay effect on top of the view container.
| View3D | ||
|
render():void
Renders a snapshot of the view to the render session's view container.
| View3D | ||
|
updateScreenClipping():void
| View3D | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when a user presses the let hand mouse button while the cursor is over a 3d object | View3D | |||
| Dispatched when a user moves the cursor while it is over a 3d object | View3D | |||
| Dispatched when a user moves the cursor away from a 3d object | View3D | |||
| Dispatched when a user moves the cursor over a 3d object | View3D | |||
| Dispatched when a user releases the let hand mouse button while the cursor is over a 3d object | View3D | |||
| background | property |
public var background:Sprite
A background sprite positioned under the rendered scene.
| blockerarray | property |
public var blockerarray:BlockerArray
| blockers | property |
public var blockers:Dictionary
| camera | property |
camera:Camera3D [read-write]Camera used when rendering.
Implementation public function get camera():Camera3D
public function set camera(value:Camera3D):void
See also
| cameraVarsStore | property |
cameraVarsStore:CameraVarsStore [read-only] public function get cameraVarsStore():CameraVarsStore
| clipping | property |
clipping:Clipping [read-write]
Clipping area used when rendering.
If null, the visible edges of the screen are located with the Clipping.screen() method.
public function get clipping():Clipping
public function set clipping(value:Clipping):void
See also
| drawPrimitiveStore | property |
drawPrimitiveStore:DrawPrimitiveStore [read-only] public function get drawPrimitiveStore():DrawPrimitiveStore
| forceUpdate | property |
public var forceUpdate:Boolean
Defines whether the view always redraws on a render, or just redraws what 3d objects change. Defaults to false.
See also
| hud | property |
public var hud:Sprite
A container for 2D overlays positioned over the rendered scene.
| mouseEvents | property |
public var mouseEvents:Boolean
Enables/Disables mouse interactivity.
| mouseMaterial | property |
| mouseObject | property |
| mouseZeroMove | property |
public var mouseZeroMove:Boolean
Forces mousemove events to fire even when cursor is static.
| overlay | property |
public var overlay:Sprite
An overlay sprite positioned on top of the rendered scene.
| renderer | property |
renderer:IRenderer [read-write]Renderer object used to traverse the scenegraph and output the drawing primitives required to render the scene to the view.
Implementation public function get renderer():IRenderer
public function set renderer(value:IRenderer):void
| scene | property |
scene:Scene3D [read-write]Scene used when rendering.
Implementation public function get scene():Scene3D
public function set scene(value:Scene3D):void
See also
| screenClipping | property |
| session | property |
session:AbstractRenderSession [read-write]Session object used to draw all drawing primitives returned from the renderer to the view container.
Implementation public function get session():AbstractRenderSession
public function set session(value:AbstractRenderSession):void
See also
| sourceURL | property |
public var sourceURL:String
Optional string for storing source url.
| stats | property |
| statsOpen | property |
public var statsOpen:Boolean
Keeps track of whether the stats panel is currently open.
See also
| statsPanel | property |
| updated | property |
updated:Boolean [read-only]Flag used to determine if the camera has updated the view.
Implementation public function get updated():Boolean
See also
| View3D | () | constructor |
public function View3D(init:Object = null)
init:Object (default = null) — [optional] An initialisation object for specifying default instance properties.
|
stats:Boolean (default = true) | |
session:Object | |
scene:ObjectOrInit (default = Scene3D) | |
camera:ObjectOrInit (default = Camera3D) | |
renderer:Object | |
clipping:Object (default = Clipping) | |
x:Number (default = 0) | |
y:Number (default = 0) | |
forceUpdate:Boolean (default = false) | |
mouseZeroMove:Boolean (default = false) | |
mouseEvents:Boolean (default = true) |
| addOnMouseDown | () | method |
public function addOnMouseDown(listener:Function):void
Default method for adding a mouseDown3d event listener.
Parameterslistener:Function — The listener function.
|
| addOnMouseMove | () | method |
public function addOnMouseMove(listener:Function):void
Default method for adding a mouseMove3d event listener.
Parameterslistener:Function — The listener function.
|
| addOnMouseOut | () | method |
public function addOnMouseOut(listener:Function):void
Default method for adding a 3d mouseOut event listener.
Parameterslistener:Function — The listener function.
|
| addOnMouseOver | () | method |
public function addOnMouseOver(listener:Function):void
Default method for adding a 3d mouseOver event listener.
Parameterslistener:Function — The listener function.
|
| addOnMouseUp | () | method |
public function addOnMouseUp(listener:Function):void
Default method for adding a mouseUp3d event listener.
Parameterslistener:Function — The listener function.
|
| addOverlay | () | method |
public function addOverlay(value:IOverlay):void
Adds an overlay effect on top of the view container.
Parametersvalue:IOverlay |
| addSourceURL | () | method |
public function addSourceURL(url:String):void
Defines a source url string that can be accessed though a View Source option in the right-click menu. Requires the stats panel to be enabled.
Parametersurl:String — The url to the source files.
|
| clear | () | method |
public function clear():void
Clears previously rendered view from all render sessions.
See also
| findHit | () | method |
public function findHit(session:AbstractRenderSession, x:Number, y:Number):void
Finds the object that is rendered under a certain view coordinate. Used for mouse click events.
Parameterssession:AbstractRenderSession |
|
x:Number |
|
y:Number |
| fireMouseEvent | () | method |
public function fireMouseEvent(type:String, x:Number, y:Number, ctrlKey:Boolean = false, shiftKey:Boolean = false):void
Collects all information from the given type of 3d mouse event into a MouseEvent3D object that can be accessed from the getMouseEvent() method.
type:String — The type of 3d mouse event being triggered - can be MOUSE_UP, MOUSE_DOWN, MOUSE_OVER, MOUSE_OUT, and MOUSE_MOVE.
|
|
x:Number — The x coordinate being used for the 3d mouse event.
|
|
y:Number — The y coordinate being used for the 3d mouse event.
|
|
ctrlKey:Boolean (default = false) — [optional] The ctrl key value being used for the 3d mouse event.
|
|
shiftKey:Boolean (default = false) — [optional] The shift key value being used for the 3d mouse event.
|
See also
| fireMouseMoveEvent | () | method |
public function fireMouseMoveEvent(force:Boolean = false):void
Manually fires a mouseMove3D event.
Parametersforce:Boolean (default = false) |
| getBitmapData | () | method |
public function getBitmapData():BitmapData
Returns the bitmapData of the rendered scene.
session is required to be an instance of BitmapRenderSession, otherwise an error is thrown.
BitmapData — The rendered view image.
|
— incorrect session object - require BitmapRenderSession.
|
See also
| getContainer | () | method |
public function getContainer():DisplayObject
Returns the DisplayObject container of the rendered scene.
DisplayObject — The DisplayObject containing the output from the render session of the view.
|
See also
| getMouseEvent | () | method |
public function getMouseEvent(type:String):MouseEvent3D
Returns a 3d mouse event object populated with the properties from the hit point.
Parameterstype:String |
MouseEvent3D |
| removeOnMouseDown | () | method |
public function removeOnMouseDown(listener:Function):void
Default method for removing a mouseDown3d event listener.
Parameterslistener:Function — The listener function.
|
| removeOnMouseMove | () | method |
public function removeOnMouseMove(listener:Function):void
Default method for removing a mouseMove3D event listener.
Parameterslistener:Function — The listener function.
|
| removeOnMouseOut | () | method |
public function removeOnMouseOut(listener:Function):void
Default method for removing a 3d mouseOut event listener.
Parameterslistener:Function — The listener function.
|
| removeOnMouseOver | () | method |
public function removeOnMouseOver(listener:Function):void
Default method for removing a 3d mouseOver event listener.
Parameterslistener:Function — The listener function.
|
| removeOnMouseUp | () | method |
public function removeOnMouseUp(listener:Function):void
Default method for removing a 3d mouseUp event listener.
Parameterslistener:Function — The listener function.
|
| removeOverlay | () | method |
public function removeOverlay(value:IOverlay):void
Removes an overlay effect on top of the view container.
Parametersvalue:IOverlay |
| render | () | method |
public function render():void
Renders a snapshot of the view to the render session's view container.
See also
| updateScreenClipping | () | method |
public function updateScreenClipping():void
| mouseDown | event |
away3d.events.MouseEvent3D
Dispatched when a user presses the let hand mouse button while the cursor is over a 3d object
| mouseMove | event |
away3d.events.MouseEvent3D
Dispatched when a user moves the cursor while it is over a 3d object
| mouseOut | event |
away3d.events.MouseEvent3D
Dispatched when a user moves the cursor away from a 3d object
| mouseOver | event |
away3d.events.MouseEvent3D
Dispatched when a user moves the cursor over a 3d object
| mouseUp | event |
away3d.events.MouseEvent3D
Dispatched when a user releases the let hand mouse button while the cursor is over a 3d object
Embedding Away3D in Flex based on V2.2
Custom MXML component (viewport.mxml) that makes it really easy to add Away3D support to any Flex app. Just save the component to your projects folder, drag the component on stage, position / scale the viewport, name the instance and you are ready to go. The ID of the component is what you'll use to target the Viewport, so if you name the component "Away3D", you can now set the zoom with this command: Away3D.view.camera.zoom = 3;
Source Files : http://www.flashgamer.com/2008/08/using_away3d_inside_a_flex_app.html

Finding an object\'s 2D bounds. based on V2.2
Here's a way to use the Session object within your View3D to find the bounds of an object you've drawn to the screen with view.render(). This example is built for a single object, in my case an imported OBJ file. The coordinates returned are relative to (this), the movie within which the view object is contained.
Here's a way to get the 2D bounds of an object you've drawn to your view.
// view has been defined previously, it's our View3D object.
var sessionContainer:DisplayObjectContainer = view.session.getContainer(view) as DisplayObjectContainer;
var drawnObject = sessionContainer.getChildAt(0);
var viewBounds = drawnObject.getRect(this);
trace("vb: " + viewBounds.left + "," + viewBounds.top + "/" + viewBounds.right + "," +viewBounds.bottom);
Complete View3D example based on V2.0
package
{
import away3d.containers.View3D;
import away3d.primitives.Sphere;
import flash.display.Sprite;
public class Basic01 extends Sprite
{
public function Basic01()
{
// create a viewport
var view:View3D = new View3D({x:275,y:200});
addChild(view);
// create a sphere and put it on the 3D stage
var sphere:Sphere = new Sphere();
view.scene.addChild(sphere);
// render the view
view.render();
}
}
}This code will create a new viewport (View3D), set it up and render a sphere. The x/y parameters passed to View3D should be exactly half the width/height of your SWF, so {x:275,y:200} is correct for the standard 550x400 pixel Flash Movie.
Place View3D in the middle of your SWF based on V1.9.2
var swd:Number=640;
var swh:Number=480;
var view:View3D=new View3D({x:swd / 2,y:swh / 2});