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: forked from: massmedian challenge

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

// forked from Inspired12's forked from: massmedian challenge
// forked from checkmate's massmedian challenge
package {
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.net.*;
    import flash.system.LoaderContext;
    [SWF(backgroundColor="0", frameRate="60", width="465", height="465")]
    public class Begineer extends Sprite{
        
        
        //-------------------------------//
        // Use properties as follows.
        //-------------------------------//
        private var _sliceList:Array;
        private var i:uint = 1000;
        private var k:Number = 1;
        private var p:DisplayObject;
        private var o:DisplayObject;
        //-------------------------------//
        // Change functions as follows.
        //-------------------------------//
        public function updateEnterFrame( e:Event ):void {
            var myShape:Shape = new Shape();
            addChild(myShape);
            myShape.graphics.beginFill(0xcc0000);
            myShape.graphics.drawRect(0, 150, 465, 165);
            myShape.graphics.beginFill(0xcccccc);
            myShape.graphics.drawEllipse(80, 150, 300,165);
            myShape.graphics.beginFill(0x000000);
            myShape.graphics.drawCircle(stage.stageWidth / 2, stage.stageHeight / 2, 80);
            myShape.graphics.beginFill(0xcc0000);
            myShape.graphics.drawCircle(stage.stageWidth / 2, stage.stageHeight / 2, 60);
            setChildIndex(myShape, 0);
                   k = 0;
           for each(p in _sliceList){
                   //p.y = Math.cos(i/20)*(k/2)+200;
                        //p.x = Math.sin(i/10)*(k/2)+180;
                        //p.scaleX = 2;
                        p.x = stage.stageWidth / 2;
                        p.y = stage.stageHeight / 2;
                        p.rotation = Math.cos(i/100)*(k+i);
                        k++;
                   }
                    i++;    
        }
        //-------------------------------//
        // Do not change following codes.
        //-------------------------------//
        public function Begineer(){
            var ctxt  :LoaderContext = new LoaderContext(true);
            var loader:Loader = new Loader();
            loader.contentLoaderInfo.addEventListener( Event.COMPLETE, onLoadComplete );
            loader.load( new URLRequest("http://swf.wonderfl.net/static/assets/massmedian.png"), ctxt );
        }
        
        public function onLoadComplete(e:Event):void {
            var loader:Loader = LoaderInfo( e.target ).loader;
            loader.contentLoaderInfo.removeEventListener( Event.COMPLETE, onLoadComplete );
            
            var bitmapdata:BitmapData = new BitmapData( loader.width, loader.height, true, 0xFF0000 );
            bitmapdata.draw( loader );
            
            _sliceList = sliceBanner( bitmapdata, bitmapdata.width );
            
            addEventListener( Event.ENTER_FRAME, updateEnterFrame );
        }
        
        
        private function sliceBanner( banner:BitmapData, length:int = 100 ):Array{
            var sliceList:Array = [];
            var w:int = Math.floor( banner.width/length );
            var h:int = Math.floor( banner.height );
            
            var t:int = Math.ceil( banner.width - w*length );
            var mat:Matrix = new Matrix();
                
            for( var i:int = 0; i<length; i++ ) {
                var bmpd :BitmapData = new BitmapData( w, h, true, 0xFFFF00 );
                mat.tx = -w*i;
                bmpd.draw( banner, mat );
                var part:DisplayObject = addChild( new Bitmap( bmpd ) );
                part.x = w*i;
                sliceList.push( part );
            }
            return sliceList;
        }
    }
}