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

ひよこちゃん「バカめ!そっちはニセモノだッ!!」

Get Adobe Flash player
by undo 21 Jun 2010
package {
	
	import caurina.transitions.Tweener;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.filters.BlurFilter;
	import flash.system.Security;

	[SWF(backgroundColor="#FFFFFF", width="465", height="465", frameRate="60")]
	
	public class PiyoTest extends Sprite {
		private static var basePath:String = "http://assets.wonderfl.net/images/related_images/";
		private static var sunshinePath:String = "9/9b/9bbe/9bbec77d53bddc5e7a5f2c00abbade6bd641c549";
		private var loader:PiyoLoader;
		private static var piyoPath:String = "http://www.project-nya.jp/images/flash/piyo.swf";
		private var piyo:MovieClip;
		private var filter:BlurFilter;
		
		public function PiyoTest() {
			//Wonderfl.disable_capture();
			//Wonderfl.capture_delay(8);
			init();
		}
		
		private function init():void {
			var sky:Sky = new Sky(465, 350);
			addChild(sky);
			var ground:Ground = new Ground(465, 115);
			addChild(ground);
			ground.y = 350;
			var sun:Sun = new Sun(100);
			addChild(sun);
			sun.x = 10;
			sun.y = 10;
			var shine:PhotoLoader = new PhotoLoader();
			addChild(shine);
			shine.alpha = 0.5;
			shine.load(basePath + sunshinePath);
			/*
			var label:Label = new Label(200, 80);
			addChild(label);
			label.x = 132;
			label.y = 100;
			label.text = "KTween";
			label.textColor = 0xFFFFFF;
			label.alpha = 0.2;
			*/
			loader = new PiyoLoader();
			loader.addEventListener(PiyoLoader.COMPLETE, complete, false, 0, true);
			loader.load(piyoPath);
			
		}
		private function complete(evt:Event):void {
			loader.removeEventListener(PiyoLoader.COMPLETE, complete);
			piyo = loader.content;
			addChild(piyo);
			piyo.x = 232;
			piyo.y = 380;
			piyo.scaleX = piyo.scaleY = 2;
			loader = null;
			
			this.filter = new BlurFilter(0,0,1);
			start();
		}
		private function start():void
		{
			this.piyo.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
			//this.piyo.addEventListener(MouseEvent.MOUSE_OUT, onOut);
			this.addEventListener(Event.ENTER_FRAME, onEnter);
		}
		private function onEnter(evt:Event):void
		{
			this.piyo.filters = [this.filter];
		}
		private function onMove(evt:MouseEvent):void
		{
			this.piyo.removeEventListener(MouseEvent.MOUSE_MOVE, onMove);
			
			Tweener.removeAllTweens();
			Tweener.addTween(this.filter,{blurX:100, time:0.1, transition:'easeInCubic'});
			Tweener.addTween(this.piyo,{alpha:0, time:0.1, transition:'easeInCubic', onComplete:onNisemonoComp});
		}
		private function onNisemonoComp():void
		{
			this.piyo.x = Math.random()*350+50;
			this.piyo.y = Math.random()*80+380;
			this.piyo.scaleX = this.piyo.scaleY = Math.random()*2+0.5;
			
			Tweener.addTween(this.filter,{blurX:0, time:0.1, transition:'easeOutCubic'});
			Tweener.addTween(this.piyo,{alpha:1, time:0.1, transition:'easeOutCubic', onComplete:onHonmonoComp});
		}
		private function onHonmonoComp():void
		{
			this.piyo.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
		}
	}
	
}


import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.HTTPStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.system.Security;
import flash.system.LoaderContext;

class PiyoLoader extends Sprite {
	private var loader:Loader;
	private var info:LoaderInfo;
	public var content:MovieClip;
	public static const IO_ERROR:String = IOErrorEvent.IO_ERROR;
	public static const HTTP_STATUS:String = HTTPStatusEvent.HTTP_STATUS;
	public static const SECURITY_ERROR:String = SecurityErrorEvent.SECURITY_ERROR;
	public static const INIT:String = Event.INIT;
	public static const COMPLETE:String = Event.COMPLETE;
	
	public function PiyoLoader() {
		Security.allowDomain("www.project-nya.jp");
		loader = new Loader();
		info = loader.contentLoaderInfo;
	}
	
	public function load(file:String):void {
		info.addEventListener(IOErrorEvent.IO_ERROR, ioerror, false, 0, true);
		info.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpstatus, false, 0, true);
		info.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityerror, false, 0, true);
		info.addEventListener(Event.INIT, initialize, false, 0, true);
		info.addEventListener(Event.COMPLETE, complete, false, 0, true);
		try {
			loader.load(new URLRequest(file), new LoaderContext(true));
		} catch (err:Error) {
			trace(err.message);
		}
	}
	public function unload():void {
		loader.unload();
	}
	private function ioerror(evt:IOErrorEvent):void {
		loader.unload();
		dispatchEvent(new Event(PiyoLoader.IO_ERROR));
	}
	private function httpstatus(evt:HTTPStatusEvent):void {
		dispatchEvent(new Event(PiyoLoader.HTTP_STATUS));
	}
	private function securityerror(evt:SecurityErrorEvent):void {
		dispatchEvent(new Event(PiyoLoader.SECURITY_ERROR));
	}
	private function initialize(evt:Event):void {
		content = MovieClip(info.content);
		dispatchEvent(new Event(PiyoLoader.INIT));
	}
	private function complete(evt:Event):void {
		info.removeEventListener(IOErrorEvent.IO_ERROR, ioerror);
		info.removeEventListener(HTTPStatusEvent.HTTP_STATUS, httpstatus);
		info.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityerror);
		info.removeEventListener(Event.INIT, initialize);
		info.removeEventListener(Event.COMPLETE, complete);
		//addChild(loader);
		dispatchEvent(new Event(PiyoLoader.COMPLETE));
	}
	
}


import flash.display.Shape;
import flash.geom.Matrix;
import flash.display.GradientType;

class Sky extends Shape {
	private static var _width:uint;
	private static var _height:uint;
	private static var color1:uint = 0x3F68AB;
	private static var color2:uint = 0x77B2EE;
	
	public function Sky(w:uint, h:uint) {
		_width = w;
		_height = h;
		draw();
	}
	
	private function draw():void {
		var colors:Array = [color1, color2];
		var alphas:Array = [1, 1];
		var ratios:Array = [0, 255];
		var matrix:Matrix = new Matrix();
		matrix.createGradientBox(_width, _height, 0.5*Math.PI, 0, 0);
		graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
		graphics.drawRect(0, 0, _width, _height);
		graphics.endFill();
	}
	
}


import flash.display.Shape;
import flash.geom.Matrix;
import flash.display.GradientType;

class Ground extends Shape {
	private static var _width:uint;
	private static var _height:uint;
	private static var color1:uint = 0x99CC33;
	private static var color2:uint = 0x7EB133;
	
	public function Ground(w:uint, h:uint) {
		_width = w;
		_height = h;
		draw();
	}
	
	private function draw():void {
		var colors:Array = [color1, color2];
		var alphas:Array = [1, 1];
		var ratios:Array = [0, 255];
		var matrix:Matrix = new Matrix();
		matrix.createGradientBox(_width, _height, 0.5*Math.PI, 0, 0);
		graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
		graphics.drawRect(0, 0, _width, _height);
		graphics.endFill();
	}
	
}


import flash.display.Shape;
import flash.geom.Matrix;
import flash.display.GradientType;

class Sun extends Shape {
	private static var radius:uint;
	private static var color:uint = 0xFFFFFF;
	
	public function Sun(r:uint) {
		radius = r;
		draw();
	}
	
	private function draw():void {
		var colors:Array = [color, color, color];
		var alphas:Array = [1, 0.3, 0];
		var ratios:Array = [25, 102, 231];
		var matrix:Matrix = new Matrix();
		matrix.createGradientBox(radius*2, radius*2, 0, -radius, -radius);
		graphics.beginGradientFill(GradientType.RADIAL, colors, alphas, ratios, matrix);
		graphics.drawCircle(0, 0, radius);
		graphics.endFill();
	}
	
}


import flash.display.Sprite;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.HTTPStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.display.Bitmap;
import flash.system.LoaderContext;

class PhotoLoader extends Sprite {
	private var loader:Loader;
	private var info:LoaderInfo;
	public var content:Bitmap;
	private var smoothing:Boolean;
	public static const IO_ERROR:String = IOErrorEvent.IO_ERROR;
	public static const HTTP_STATUS:String = HTTPStatusEvent.HTTP_STATUS;
	public static const SECURITY_ERROR:String = SecurityErrorEvent.SECURITY_ERROR;
	public static const INIT:String = Event.INIT;
	public static const COMPLETE:String = Event.COMPLETE;
	
	public function PhotoLoader() {
		loader = new Loader();
		info = loader.contentLoaderInfo;
	}
	
	public function load(file:String, s:Boolean = false):void {
		smoothing = s;
		info.addEventListener(IOErrorEvent.IO_ERROR, ioerror, false, 0, true);
		info.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpstatus, false, 0, true);
		info.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityerror, false, 0, true);
		info.addEventListener(Event.INIT, initialize, false, 0, true);
		info.addEventListener(Event.COMPLETE, complete, false, 0, true);
		try {
			loader.load(new URLRequest(file), new LoaderContext(true));
		} catch (err:Error) {
			trace(err.message);
		}
	}
	public function unload():void {
		loader.unload();
	}
	private function ioerror(evt:IOErrorEvent):void {
		loader.unload();
		dispatchEvent(new Event(PhotoLoader.IO_ERROR));
	}
	private function httpstatus(evt:HTTPStatusEvent):void {
		dispatchEvent(new Event(PhotoLoader.HTTP_STATUS));
	}
	private function securityerror(evt:SecurityErrorEvent):void {
		dispatchEvent(new Event(PhotoLoader.SECURITY_ERROR));
	}
	private function initialize(evt:Event):void {
		content = Bitmap(info.content);
		if (smoothing) content.smoothing = true;
		dispatchEvent(new Event(PhotoLoader.INIT));
	}
	private function complete(evt:Event):void {
		info.removeEventListener(IOErrorEvent.IO_ERROR, ioerror);
		info.removeEventListener(HTTPStatusEvent.HTTP_STATUS, httpstatus);
		info.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityerror);
		info.removeEventListener(Event.INIT, initialize);
		info.removeEventListener(Event.COMPLETE, complete);
		addChild(loader);
		dispatchEvent(new Event(PhotoLoader.COMPLETE));
	}
	
}


import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;

class Label extends Sprite {
	private var txt:TextField;
	private static var fontType:String = "Arial";
	private var txtWidth:uint;
	private var fontSize:uint;
	
	public function Label(w:uint, s:uint) {
		txtWidth = w;
		fontSize = s;
		draw();
	}
	
	private function draw():void {
		txt = new TextField();
		txt.width = txtWidth;
		addChild(txt);
		txt.autoSize = TextFieldAutoSize.CENTER;
		txt.type = TextFieldType.DYNAMIC;
		txt.selectable = false;
		//txt.embedFonts = true;
		//txt.antiAliasType = AntiAliasType.ADVANCED;
		var tf:TextFormat = new TextFormat();
		tf.font = fontType;
		tf.size = fontSize;
		tf.align = TextFormatAlign.CENTER;
		txt.defaultTextFormat = tf;
	}
	public function set text(param:String):void {
		txt.text = param;
	}
	public function set textColor(param:uint):void {
		txt.textColor = param;
	}
	
}