flash on 2010-7-16

by hazel_eyes
♥0 | Line 26 | Modified 2010-07-16 18:01:09 | MIT License
play

ActionScript3 source code

/**
 * Copyright hazel_eyes ( http://wonderfl.net/user/hazel_eyes )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/5bXC
 */

package {
    import flash.display.Sprite;
    import flash.events.*;
    import org.papervision3d.view.*
    import org.papervision3d.materials.*
    import org.papervision3d.materials.special.*;
    import org.papervision3d.materials.shadematerials.*;
    import org.papervision3d.objects.primitives.*
    import org.papervision3d.lights.*;
        
    public class FlashTest extends BasicView {
        private var sphere:Sphere;
        public function FlashTest() {
            var light:PointLight3D = new PointLight3D(true, false);
            //var material:WireframeMaterial = new WireframeMaterial(0xFF0000);
            //var material:ColorMaterial = new ColorMaterial(0xff00ff,0.5);
            //var material:CompositeMaterial = new CompositeMaterial();
            //var material:FlatShadeMaterial = new FlatShadeMaterial(light, 0xFFFFFF, 0x111111, 50);
            var material:PhongMaterial = new PhongMaterial(light, 0xFFFFFF, 0x111111, 0);
            light.x = 300;
            light.y = 500;
            //material.addMaterial(new ColorMaterial(0xff00ff,0.5));
           //material.addMaterial(new WireframeMaterial(0xFF0000));
            sphere = new Sphere(material, 200, 15, 15);
            scene.addChild(sphere);
            startRendering();
            addEventListener(Event.ENTER_FRAME, loop);
        }
    
        private function loop(e:Event):void{
            sphere.rotationY += 1;
        }
    }
}