In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: flash on 2010-3-19

必要なライブラリをインポートします
// forked from hacker_3q88gl5n's flash on 2010-3-19
// forked from clockmaker's [PV3D] Simple Sphere
package  
{
    
    
        import flash.events.Event;
    
    // 必要なライブラリをインポートします
    import org.papervision3d.materials.ColorMaterial;
    import org.papervision3d.materials.special.CompositeMaterial;
        import org.papervision3d.lights.PointLight3D;
        import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
    import org.papervision3d.materials.WireframeMaterial;
    import org.papervision3d.objects.primitives.Plane;
        import org.papervision3d.objects.primitives.Sphere;
        import org.papervision3d.view.BasicView;
    import org.papervision3d.core.effects.view.ReflectionView;
    

     
    public class Main extends ReflectionView
    {
        private var ball:Sphere;
        
        public function Main() 
        {
            init();
        }
        
        private function init():void
        {
            
            
            //カメラ位置////////////////////////////////////////////////
            camera.y = 300; 
            
            
            //床の作成//////////////////////////////////////////////////
        
            var col:ColorMaterial = new ColorMaterial(0xffffff, 0.5);
            var co:CompositeMaterial = new CompositeMaterial();
            
            co.addMaterial(col);
            
            var floor:Plane = new Plane(co, 2000, 2000, 12, 12);
            floor.pitch( -90);

                        //床を3Dシーンに表示/////////////////////////////////////////
            scene.addChild(floor);

            
                        // 球面を作成///////////////////////////////////////////////
            var material: CompositeMaterial = new CompositeMaterial();
            material.addMaterial(new WireframeMaterial(0xffffff));
            material.addMaterial(new ColorMaterial(0x1414ff));
            
                        ball = new Sphere(material, 200, 4, 2);
            ball.y = 200;

            // 球面を3Dシーンに表示//////////////////////////////////////
            scene.addChild(ball);
            
            
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
        
        private function onEnterFrame(e:Event):void 
        {
            ball.rotationY -= mouseY / -100;
            ball.rotationY += mouseX / -100;
            singleRender();
        }
        
    }
    
}