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: colin challenge for amateurs

Draw a Tasty Ramen !
* 
* You can edit and modify every piece of this code.
* Load more pictures of GU (ingredients of ramen)
* from flickr or draw one by yourself.
* Make it look tasty.
*
/**
 * Copyright nyamogera ( http://wonderfl.net/user/nyamogera )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/dtx6
 */

// forked from checkmate's colin challenge for amateurs
/*
 * 
 * Draw a Tasty Ramen !
 * 
 * You can edit and modify every piece of this code.
 * Load more pictures of GU (ingredients of ramen)
 * from flickr or draw one by yourself.
 * Make it look tasty.
 *
 */
package{
    import flash.display.Sprite;
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.system.*;

    [SWF(width="460", height="460", backgroundColor="0xFFFFFF", frameRate="30")]

    public class FlashTest extends Sprite{
        private var _loader        :Loader;
        private var _loaderInfo    :LoaderInfo;
        private var _loader_GU     :Loader;
        private var _loaderInfo_GU :LoaderInfo;

        private var RAMEN_URL :String   = "http://farm3.static.flickr.com/2589/3787648401_0b3d62a314_o.png";
        private var NARUTO1_URL :String = "http://farm3.static.flickr.com/2466/3787648415_1f857d46cf_o.png";
        private var NARUTO2_URL :String = "http://farm4.static.flickr.com/3560/3788456920_5101174e6c_o.png";
        private var MENMA_URL :String   = "http://farm3.static.flickr.com/2628/3788456906_91e357245f_o.png";

        private var pattern:Pattern;
        
        public function FlashTest(){
            init();
        }
        private function init():void{
            stage.scaleMode=StageScaleMode.NO_SCALE;
            stage.align=StageAlign.TOP_LEFT;

            _loader=new Loader();
            _loader.load(new URLRequest(RAMEN_URL));

            _loaderInfo=_loader.contentLoaderInfo;
            _loaderInfo.addEventListener(Event.COMPLETE,onLoadComplete);

	    pattern = new Pattern(67);
	    	
	    pattern.x = 230;
	    pattern.y = 230;

            pattern.scaleX = pattern.scaleY = 3;
        }
        private function onLoadComplete(event:Event):void{
            _loaderInfo.removeEventListener(Event.COMPLETE,onLoadComplete);
            addChild(_loader);
            load_GU();
        }
        private function load_GU():void{
            _loader_GU=new Loader();
            _loader_GU.load(new URLRequest(NARUTO1_URL));

            _loaderInfo_GU=_loader_GU.contentLoaderInfo;
            _loaderInfo_GU.addEventListener(Event.COMPLETE,onLoadComplete_GU);
        }
        private function onLoadComplete_GU(event:Event):void{
            _loaderInfo_GU.removeEventListener(Event.COMPLETE,onLoadComplete_GU);

            // position adjustment for GU
            _loader_GU.x = 160;
            _loader_GU.y = 160;
            addChild(_loader_GU);
            addChild( pattern );
        }

    }
}


import flash.display.Graphics;
import flash.display.Shape;

internal class Pattern extends flash.display.Sprite
{
	private const uzu:Array = [[0,12], [0, -4], [-2, -4], [-2, -14],[2, -14], [2, -2], [-4, -2], [-4, -16], [4, -16],
	[4,0], [-4, 0], [-4, 16], [4, 16], [4, 2], [-2, 2], [-2, 14], [2,14], [2, 4], [0, 4], [0, 12]];
	
	public function Pattern(radius:Number)
	{
		var g:Graphics = graphics;
		g.lineStyle(1, 0xff0000);
		
		for ( var a:int = 0; a < 10; a ++ )
		{
			var kyori :Number = Math.sqrt(uzu[0][0] *uzu[0][0]  +uzu[0][1] * uzu[0][1]);
			var angleUzu:Number = Math.atan2(-uzu[0][1],uzu[0][0]);
			
			var angle:Number = (36 * a) /180 *(Math.PI) ;
			
			var rx:Number = Math.cos(angle)*radius + kyori * Math.cos(angleUzu+angle);
			var ry:Number =  Math.sin( angle )*radius  + kyori * Math.sin(angleUzu + angle) ;
			
			g.moveTo(rx, ry);
		
			var length:int =  uzu.length;
			for ( var i:int = 1; i < length; i++)
			{
				kyori  = Math.sqrt(uzu[i][0] * uzu[i][0] +uzu[i][1] * uzu[i][1]);
				angleUzu = Math.atan2( -uzu[i][1],uzu[i][0]) + Math.PI;
				rx = Math.cos( angle ) * (radius ) + kyori * Math.cos(angleUzu + angle) ;
				ry = Math.sin( angle ) * (radius ) + kyori * Math.sin(angleUzu + angle) ;
				g.lineTo(rx,ry);
			}
		}
	}
}