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

Sphere made from planes

Sphere made from planes.
* @see http://forum.alternativaplatform.com/posts/list/2969.page#50884
Get Adobe Flash player
by makc3d 19 Oct 2010

    Talk

    test2234478 at 26 Feb 2013 19:28
    hi all There is an error is that private static var _initialized:Boolean = Wonderfl.@%@function ()@%@30@%@();
    test2234478 at 26 Feb 2013 19:29
    hi all There is an error is that private static var _initialized:Boolean = Wonderfl.@%@function ()@%@30@%@();
    test2234478 at 26 Feb 2013 19:29
    could any one say the solution
    test2234478 at 26 Feb 2013 19:29
    could any one say the solution
    test2234478 at 26 Feb 2013 19:29
    could any one say the solution
    test2234478 at 26 Feb 2013 19:36
    could any one say the solution
    test2234478 at 26 Feb 2013 19:36
    could any one say the solution
    test2234478 at 26 Feb 2013 19:36
    could any one say the solution
    test2234478 at 26 Feb 2013 19:43
    hi all there is an error private static var _initialized:Boolean = Wonderfl.@%@function ()@%@30@%@(); kindly please help any body say the solution for it
    makc3d at 26 Feb 2013 21:19
    > could any one say the solution "solution"
    test2234478 at 27 Feb 2013 06:23
    hi all there is an error private static var _initialized:Boolean = Wonderfl.@%@function ()@%@30@%@(); kindly please help any body say the solution for it
    test2234478 at 27 Feb 2013 06:23
    hi all there is an error private static var _initialized:Boolean = Wonderfl.@%@function ()@%@30@%@(); kindly please help any body say the solution for it

    Tags

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

/**
 * Sphere made from planes.
 * @see http://forum.alternativaplatform.com/posts/list/2969.page#50884
 */
package {   
    import alternativ5.engine3d.controllers.WalkController;   
    import alternativ5.engine3d.core.Camera3D;   
    import alternativ5.engine3d.core.Object3D;   
    import alternativ5.engine3d.core.Scene3D;   
    import alternativ5.engine3d.display.View;   
  
    import alternativ5.engine3d.materials.FillMaterial;   
    import alternativ5.engine3d.primitives.Plane;   
    import alternativ5.types.Point3D;   
  
    import flash.display.Sprite;   
    import flash.events.Event;   
  
    [SWF (backgroundColor="0", width="465", height="465", frameRate="30")]   
    public class Main extends Sprite {   
  
        private var view:View;   
        private var scene:Scene3D;   
        private var camera:Camera3D;   
        private var controller:WalkController;   
  
        public function Main() {   
            scene = new Scene3D();   
            scene.root = new Object3D();   
            var cameraContainer:Object3D = new Object3D();   
            scene.root.addChild(cameraContainer);   
            camera = new Camera3D();   
            cameraContainer.addChild(camera);   
            camera.y = -200;   
            camera.rotationX = -Math.PI/2;   
            view = new View(camera, 465, 465);   
            addChild(view);   
            controller = new WalkController(stage, cameraContainer);   
  
            createGeometry();   
  
            stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);   
        }   
  
        private function createGeometry():void {   
            var planeWidth:Number = 10;   
            var planeHength:Number = 15;   
            var radius:Number = 100;   
            var numParallels:int = 10;   
            var alphaStep:Number = Math.PI/(numParallels + 1);   
            for (var pIndex:int = 0; pIndex < numParallels; pIndex++) {   
                var alpha:Number = alphaStep*(pIndex + 1);   
				var numMeridians:int = 10*Math.sin(alpha)/Math.sin(alphaStep);   
				var betaStep:Number = 2*Math.PI/numMeridians;   
                var z:Number = radius*Math.cos(alpha);   
                var xy:Number = radius*Math.sin(alpha);   
                for (var mIndex:int = 0; mIndex < numMeridians; mIndex++) {   
                    var beta:Number = betaStep*mIndex;   
                    var x:Number = -xy*Math.sin(beta);   
                    var y:Number = xy*Math.cos(beta);   
                    var plane:Plane = new Plane(planeWidth, planeHength);   
                    plane.setMaterialToSurface(new FillMaterial(0xFF0000, 1, "normal", 0, 0xFFFFFF), "front");   
                    plane.setMaterialToSurface(new FillMaterial(0x660000, 1, "normal", 0, 0xFFFFFF), "back");   
                    plane.coords = new Point3D(x, y, z);   
                    plane.rotationX = -alpha;   
                    plane.rotationZ = beta;   
                    scene.root.addChild(plane);   
                }   
            }   
        }   
  
        private function onEnterFrame(e:Event):void {   
            controller.processInput();   
            scene.calculate();   
        }   
    }   
}