package com.zeronine.basicCube
{
 import away3d.containers.View3D;
 import away3d.materials.WireframeMaterial;
 import away3d.primitives.Cube;
 import flash.display.Sprite;
 import flash.events.Event;
 
 public class BasicCube extends Sprite
 {
  private var _view:View3D;
  private var _cube:Cube;
 
  public function BasicCube()
  {
   viewSet();
  }
 
  private function viewSet():void
  {
   _view = new View3D();
   _view.x = stage.stageWidth / 2;
   _view.y = stage.stageHeight / 2;
   
   this.addChild(_view);
   
   addEventListener(Event.ENTER_FRAME, engine);
   cubeSet();
  }
 
  private function cubeSet():void
  {
   _cube = new Cube();
   _cube.material = new WireframeMaterial(0xff0000);
   
   _cube.width = 100;
   _cube.height = 100;
   _cube.depth = 100;
   
   _view.scene.addChild(_cube);
  }
 
  private function engine(e:Event):void
  {
   _view.render();
   _cube.rotationY += 2;
   _cube.rotationX += 2;
  }
 }
}




'ActionScript3.0 > Away3d 3' 카테고리의 다른 글

Away3d_Cylineder();  (0) 2010.11.29
Away3d_Cone();  (0) 2010.11.29
Away3d_Plane();  (0) 2010.11.29
Away3d_Sphere();  (0) 2010.11.29
Away3d _ view3D();  (0) 2010.11.29

+ Recent posts