package { import away3d.containers.View3D; import away3d.core.light.DirectionalLight; import away3d.lights.DirectionalLight3D; import away3d.materials.PhongColorMaterial; import away3d.primitives.Cone; import flash.display.Sprite; import flash.events.Event; [SWF(width="500", height="220", frameRate="60", backgroundColor="#FFFFFF")] public class Basic08_cone extends Sprite { private var view:View3D; private var cone1:Cone; private var cone2:Cone; private var cone3:Cone; private var cover:Cover; private var light:DirectionalLight3D; public function Basic08_cone() { // create a viewport view = new View3D({x:250,y:110}); addChild(view); // create three cones with different options cone1 = new Cone({material:"red#black",segmentsH:3,segmentsW:15,heigth:100,radius:50,x:-170}); view.scene.addChild(cone1); cone2 = new Cone({material:"orange#black",segmentsH:1,segmentsW:15,heigth:100,radius:50,x:0,openEnded:true,bothsides:true}); view.scene.addChild(cone2); var mat:PhongColorMaterial = new PhongColorMaterial(0x7777ff); cone3 = new Cone({material:mat,segmentsH:1,segmentsW:15,heigth:100,radius:50,x:170}); view.scene.addChild(cone3); // Add a light to make the Phong material visible light = new DirectionalLight3D({x:100,y:300,z:500}); light.color = 0xffffff; light.specular = 1; light.diffuse = .75; view.scene.addChild(light); // add the cover that prevents the problem with too many SWF files running at once view.render(); cover = new Cover(this,500,220); addChild(cover); // render on enterframe this.addEventListener(Event.ENTER_FRAME,render); } private function render(e:Event):void { if(!cover.visible) { // Rotate the cube cone1.rotationX += 1; cone1.rotationY += .5; cone2.rotationX += 1; cone2.rotationY += .5; cone3.rotationX += 1; cone3.rotationY += .5; // Render the view view.render(); } } } }