Changing Primitives, wireframes and materials with button event

Software: Away3D 4.x

ThaowMatt, Newbie
Posted: 16 April 2013 12:52 PM   Total Posts: 3

Hey guys i need some help on how to change primitives and removing the previous primitive showing in the scene and also changing materials on the primitive.

The code as file as been attached


These are the button events


  /**
  * Intialise the buttons events
  */
  private function changeCube(event:MouseEvent):void {
 
  var newCubeGeometry:CubeGeometry = new CubeGeometry(200, 200, 200, 50, 50, 50, true);
  var cube:Mesh = new Mesh(newCubeGeometry, redColorMaterial);
  cube.x = 100;
  cube.y = 100;
  cube.z = 100;
  scene.addChild(cube);
 
 
 
 
 
  }
 
  private function changeSphere(event:MouseEvent):void {
   
    var newSphereGeometry:SphereGeometry = new SphereGeometry(50, 16, 12, true);
    var sphere:Mesh = new Mesh(newSphereGeometry, redColorMaterial);
    scene.addChild(sphere);
   
 
 
  }
 
  private function changeCylinder(event:MouseEvent):void {
   
    var newCylinderGeometry:CylinderGeometry = new CylinderGeometry(50, 50, 100, 16, 1, true, true);
    var cylinder:Mesh = new Mesh(newCylinderGeometry, redColorMaterial);
    scene.addChild(cylinder);
   
  }
 
  private function changeTorus(event:MouseEvent):void {
   
    var newTorusGeomentry:TorusGeometry = new TorusGeometry(50, 50, 15, 8, true);
    var torus:Mesh = new Mesh(newTorusGeomentry, redColorMaterial);
    scene.addChild(torus);
   
  }
 
  private function changeWireframe(event:MouseEvent):void {
   
    var wireFrameCube:WireframeCube = new WireframeCube(100, 100, 100, 0x0000FF, 5);
   
    scene.addChild(wireFrameCube);
 
   
   
   
 
 
  }
}

}

 


And next i wont some help on how to remove the primitive on the scene when i click on another button to show another shape, material or wireframe.

Thanks, Matthew

 

File Attachments
Main.as  (File Size: 15KB - Downloads: 368)
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X