If this can help, i'm using this snippet for most of my away3d. I only
customize the camera if needed. The camera instanciation part should
be outside the class definition, but i love so much orthogonal that
it's set as default :)
package martian.space
{
import away3d.cameras.HoverCamera3D;
import away3d.cameras.lenses.OrthogonalLens;
import away3d.containers.View3D;
import away3d.core.base.Object3D;
import away3d.core.math.Number3D;
import away3d.lights.DirectionalLight3D;
import flash.events.Event;
public class Core extends View3D
{
private var _running:Boolean = false;
public function get running():Boolean { return
_running; }
public function set running(value:Boolean):void { if (value)
{ start(); } else { stop(); } }
public function Core()
{
addEventListener(Event.ADDED_TO_STAGE, initialize);
}
private function initialize(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, initialize);
replace();
//renderer = Renderer.CORRECT_Z_ORDER;
camera = new HoverCamera3D();
camera.lens = new OrthogonalLens();
camera.position = new Number3D(100, 100, 100);
camera.lookAt(new Number3D(0, 0, 0));
camera.zoom = 100;
var light:DirectionalLight3D = new DirectionalLight3D();
light.position = new Number3D(1000, 1000, 1000);
light.color = 0xFFFFFF;
light.specular = 0;
light.diffuse = 0.5;
light.ambient = 0.25;
scene.addChild(light);
stage.addEventListener(Event.RESIZE, replace);
}
public function start():void
{
if (!_running)
{
_running = true;
stage.addEventListener(Event.ENTER_FRAME,
enterFrame);
}
}
public function stop():void
{
if (_running)
{
_running = false;
stage.removeEventListener(Event.ENTER_FRAME,
enterFrame);
}
}
public function addObject(object3d:Object3D):void
{ scene.addChild(object3d); }
private function enterFrame(e:Event):void { render(); }
private function replace(e:Event = null):void
{
x = stage.stageWidth / 2;
y = stage.stageHeight / 2;
}
}
}