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-23

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

// forked from hacker_pdf0c4e1's flash on 2010-3-23
package {
    import flash.display.Sprite;
    import flash.events.*;
    import org.papervision3d.materials.*;
    import org.papervision3d.objects.primitives.*;
    import org.papervision3d.objects.*;
    import org.papervision3d.view.*;
    public class FlashTest extends BasicView{
    	private var rott:Number=0;
    	private var rotp:Number=0;
    	private var wrap:DisplayObject3D;
        public function FlashTest() {
        	wrap=new DisplayObject3D();
        	scene.addChild(wrap);
        	var material:WireframeMaterial=new WireframeMaterial(0x3399FF);
        	material.doubleSided=true;
        	var max:int=10;
        	for(var i:int=0; i<max; i++){
        		var obj:Plane =new Plane(material,200,200);
        		var rot:Number=360*i/max;
        		obj.x=600*Math.sin(rot*Math.PI/180);
        		obj.y=600*Math.cos(rot*Math.PI/180);
                        obj.x += 0.000001;
        		obj.lookAt(DisplayObject3D.ZERO);
        		wrap.addChild(obj);
        	}
                obj = new Plane(material, 1000, 1000);
                wrap.addChild(obj);
        	startRendering();
        	addEventListener(Event.ENTER_FRAME,loop);
        }
        private function loop(e:Event):void{
        	var targetRot:Number=(mouseX/stage.stageWidth)*180 - 90;
        	rott+=(targetRot-rott)*0.5;
        	targetRot=(mouseY/stage.stageHeight)*180 - 90;
        	rotp+=(targetRot-rotp)*0.5;
        	camera.x=1000*Math.sin(rott*Math.PI/180)*Math.cos(rotp*Math.PI/180);
        	camera.z=1000*Math.cos(rott*Math.PI/180)*Math.cos(rotp*Math.PI/180);
                camera.y=1000*Math.sin(rotp*Math.PI/180);
            
        }
    }
}