Away3D(二):The View and the Scene

The View:

var view:View3D = new View3D();
addChild(view);

 

缺省情况下 ,view没有被剪裁 ,需要设置clipping 属性才行

View = new View3D({scene:viewScene,camera:cam,x:w/2,y:h/2});
var myClip:RectangleClipping = new RectangleClipping({minX:-w/2,minY:-h/2,maxX:w/2,maxY:h/2});
View.clipping = myClip;
// 一般x和y的值是场景长宽的一半
var view:View3D = new View3D({x:232, y:200});
// 或者
var view:View3D = new View3D();
view.x = 232;
view.y = 200;

 

必须调用以下函数,才能显示场景中的内容

view.render();

 

The Scene:
The Scene works just like the Stage in Flash .
可以直接通过view使用scene

view.scene

 

或者另外新建一个

var myScene:Scene3D = new Scene3D;
var view:View3D = new View3D({x:232, y:200, scene:myScene});

 

向scene添加/删除 object:

view.scene.addChild(mySphere);
view.scene.removeChild(mySphere);

 

设置场景变化 的侦听:

myScene.addEventListener(Object3DEvent.SCENECHANGED,someFunction);
myScene.removeEventListener(Object3DEvent.SCENECHANGED,someFunction);

你可能感兴趣的:(Flash)