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

Alternativa3D - Rotating tank

Get Adobe Flash player
by Pelisalinet 14 Oct 2012
    Embed
/**
 * Copyright Pelisalinet ( http://wonderfl.net/user/Pelisalinet )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2KOV
 */

package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
 
    import org.papervision3d.cameras.CameraType;
    import org.papervision3d.core.proto.MaterialObject3D;
    import org.papervision3d.events.FileLoadEvent;
    import org.papervision3d.events.InteractiveScene3DEvent;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.objects.parsers.Collada;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.BasicView;
    import org.papervision3d.view.Viewport3D;
 
    [SWF(width="640", height="480", frameRate="30", backgroundColor="#000000")]
    public class ColladaExample extends BasicView {
        private var collada:Collada;
 
        public function ColladaExample ()    {
            
            Wonderfl.capture_delay(9);            
            
            super(0, 0, true, true, CameraType.FREE);
            init();
        }
 
        private function init():void {
            camera.z = -1500;
            camera.focus = 200;
            camera.zoom = 2;
            addCollada();
        }
 
        private function addCollada():void {
            collada = new Collada();
            collada.load("http://www.pelisali.net/pro/tankgame/tanks/wasp.dae");
            collada.addEventListener(FileLoadEvent.LOAD_COMPLETE, onColladaLoaded);
            scene.addChild(collada);
        }
 
        private function onColladaLoaded(e:FileLoadEvent):void {
            collada.removeEventListener(FileLoadEvent.LOAD_COMPLETE, onColladaLoaded);
            startRendering();
        }
 
        override protected function onRenderTick(event:Event=null):void {
            collada.rotationY += 2;
            super.onRenderTick(event);
        }
    }
}