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

Away3D Gold Practice01 Plane 1枚表示

Get Adobe Flash player
by siouxcitizen 12 Jan 2013
/**
 * Copyright siouxcitizen ( http://wonderfl.net/user/siouxcitizen )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2ZWU
 */

//Away3D 4.0? Gold でPlaneを表示してみました
//
//[Away3D] Planeの頂点をランダムに移動し地面ぽくする
//http://wonderfl.net/c/l2cL
//を参考にさせて頂きました(このコードのフォーク元です)
//
package
{
    import away3d.containers.View3D;
    import away3d.debug.AwayStats;
    import away3d.entities.Mesh;
    import away3d.materials.ColorMaterial;
    import away3d.primitives.PlaneGeometry;
    import away3d.primitives.PrimitiveBase;

    import flash.events.Event;
    import flash.geom.Vector3D;

    import flash.display.Bitmap;
    import flash.display.BitmapData;

    [SWF(backgroundColor="#FFFFFF", frameRate="60", width="465", height="465")]
    public class PlaneSample extends View3D
    {
        private static const ZERO : Vector3D = new Vector3D(0, 0, 0);
        private var _planeMat : ColorMaterial;
        private var _planeGeo : PrimitiveBase;
        private var _plane : Mesh;      

        private var _capture : BitmapData = new BitmapData(465, 465, false, 0x000000);

        public function PlaneSample()
        {
           // wonderfl capture
           Wonderfl.disable_capture();
           //addChild(new Bitmap(_capture)) ;

            antiAlias = 0;
            backgroundColor = 0xa1c3c0;

            _planeMat = new ColorMaterial(0x237524, 0.85);
            _planeGeo = new PlaneGeometry(256, 256, 8, 8, true, true);
            _plane = new Mesh(_planeGeo, _planeMat);
            scene.addChild(_plane);

            camera.y = 500;
            camera.z = -100;
            addEventListener(Event.ENTER_FRAME, update);
                   
            addChild(new AwayStats());
        }

        private function update(event : Event) : void
        {
            _plane.rotationX = -(stage.mouseY - (stage.stageHeight >> 1));
            _plane.rotationY = stage.mouseX - (stage.stageWidth >> 1);
            camera.lookAt(ZERO);
            render();
            //renderer.queueSnapshot(_capture);
        }
    }
}