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: 集中線

集中線
ばばーーーん!!!!!
Get Adobe Flash player
by narutohyper 30 Mar 2010
/**
 * Copyright narutohyper ( http://wonderfl.net/user/narutohyper )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/3Gw0
 */

// forked from Dorara's 集中線
// 集中線
//     ばばーーーん!!!!!
package {
	import com.bit101.components.PushButton;
	
	import flash.display.BitmapData;
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.display.StageQuality;	
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.net.FileFilter;
	import flash.net.FileReference;
	import flash.utils.ByteArray;

	public class SyutyuSen extends Sprite
	{
		private var centerX:Number;
		private var centerY:Number;
		
		private var fileReference:FileReference;
		
		private var back:Sprite;
		private var field:Sprite;
		private var image:Sprite;
		
		private var loadButton:PushButton;
		
		public function SyutyuSen()
		{
			this.stage.scaleMode = StageScaleMode.NO_SCALE;
			this.stage.align = StageAlign.TOP_LEFT;
			this.stage.quality = StageQuality.HIGH;
						
			centerX = this.stage.stageWidth/2;
			centerY = this.stage.stageHeight/2;
			
			var OutR:Number = 1000;
			var InR:Number = 120;
			var error:Number = 100;
			var thickness:Number = 70;
		
			back = new Sprite();
			field = new Sprite();
			image = new Sprite();
			
			
			back.graphics.beginFill(0xFFFFFF);
			back.graphics.drawRect(0, 0, this.stage.stageWidth, this.stage.stageHeight);
			back.graphics.endFill();

			this.addChild(back);

			fileReference = new FileReference();
			fileReference.addEventListener(Event.SELECT, selectHandler);
			fileReference.addEventListener(Event.COMPLETE, completeHandler);

			for(var angle:int = 0; angle<360; angle++){
				var InR2:Number = (Math.random()*error) + InR;
			
				var InX:Number = InR2 * Math.cos(angle*Math.PI/180);
				var InY:Number = InR2 * Math.sin(angle*Math.PI/180);
				
				var OutX:Number = OutR * Math.cos(angle*Math.PI/180);
				var OutY:Number = OutR * Math.sin(angle*Math.PI/180);
				
				var thick:int = Math.random()*thickness;
												
				field.graphics.beginFill(0x0000000,1);
				field.graphics.moveTo(centerX+InX, centerY+InY);
				field.graphics.lineTo(centerX+OutX, centerY+OutY);
				field.graphics.lineTo(centerX+OutX+thick, centerY+OutY);
												
			}
			
			
			this.addChild(field);
			loadButton = new PushButton(this, 0, 0, "Load", upload);
		}
		
		private function upload(event:MouseEvent):void
		{
			var fileFilter:FileFilter = new FileFilter("Images", "*.jpg;*.gif;*.png");
			fileReference.browse([fileFilter]);	
		}
		
		private function selectHandler(event:Event):void
		{
			fileReference.load();
		}
		
		private function completeHandler(event:Event):void
		{
			var loader:Loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeLoadHandler);
			loader.loadBytes(fileReference.data);
			image.addChild(loader);
			this.addChildAt(image, 1);
			this.removeChild(loadButton);
		}
		
		private function completeLoadHandler(event:Event):void
		{
			image.x = centerX - event.target.width/2;
			image.y = centerY - event.target.height/2;
		}
	}
}