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 2014-5-2

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

package {
    import flash.geom.*;
    import flash.events.*;
    import flash.display.*;
    public class FlashTest extends Sprite {
        var cont:Sprite = new Sprite();
        var w:Number = 100;
        var pl:Array = new Array();
        var line:Boolean = true;
        public function FlashTest() {
            // write as3 code here..
            addChild(cont);
            //
            Plane(0,0,-(w/2),0,180);
            Plane(0,0,(w/2),0,0);
            Plane(-(w/2),0,0,0,-90);
            Plane((w/2),0,0,0,90);
            Plane(0,-(w/2),0,-90,0);
            Plane(0,(w/2),0,90,0);
            //
            Plane(0,0,-(w/4),0,180,w/2,true);
            Plane(0,0,(w/4),0,0,w/2,true);
            Plane(-(w/4),0,0,0,-90,w/2,true);
            Plane((w/4),0,0,0,90,w/2,true);
            Plane(0,-(w/4),0,-90,0,w/2,true);
            Plane(0,(w/4),0,90,0,w/2,true);
            //
            cont.x = stage.stageWidth/2;
            cont.y = stage.stageHeight/2;
            //
            addEventListener(Event.ENTER_FRAME,fr);
        }
        function fr(event:Event):void{
            cont.rotationX = (stage.stageWidth/360) * mouseY;
            cont.rotationY = (stage.stageHeight/360) * mouseX;
        }
        //
        function Plane(x_:Number,y_:Number,z_:Number,rx_:Number,ry_:Number, w_:Number=NaN, useFill:Boolean=false){
            var rect:Sprite = new Sprite();
            if ( isNaN( w_ ) ) {
                w_ = w;
            }

            if(line && !useFill) { rect.graphics.lineStyle(0,0xff6600); }
            else if (line) rect.graphics.beginFill(0xff9900, 0.4);
            rect.graphics.drawRect(-w_/2,-w_/2,w_,w_);
            rect.x = x_;
            rect.y = y_;
            rect.z = z_;
            rect.rotationX = rx_;
            rect.rotationY = ry_;
            cont.addChild(rect);
            pl.push(rect);
        }
        //
    }
}