private function initObjects():void
{
    var c:Cube = new Cube();
    scene.addChild(c);
    c.x = 100

    c.addEventListener(MouseEvent3D.MOUSE_DOWN, cubeMouseDownHandler);

    var c2:Cube = new Cube();
    c2.x = -100
    scene.addChild(c2);
    c2.addEventListener(MouseEvent3D.MOUSE_DOWN, cubeMouseDownHandler);
}

private function cubeMouseDownHandler(e:MouseEvent3D):void
{
    var target:Vector3D = camera.lookingAtTarget;
    TweenMax.to(target, 3, { x:e.target.position.x, y:e.target.position.y,
z:e.target.position.x, onUpdate:function() { camera.lookAt(target); }} );
}

Reply via email to