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

AngelBeatsの次回予告的なものをつくってみた

Get Adobe Flash player
by 7kamura 07 May 2010
/**
 * Copyright 7kamura ( http://wonderfl.net/user/7kamura )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/avlQ
 */

package
{
	import flash.display.*;
	import flash.text.TextField;	
	import flash.text.TextFormat;
	import flash.text.TextFieldAutoSize;
	import flash.utils.Timer;
	import flash.filters.*;
	import flash.events.TimerEvent;
	import flash.events.Event;
	import flash.system.*;
	import flash.net.*;
	import caurina.transitions.Tweener;
	import caurina.transitions.properties.FilterShortcuts;
	FilterShortcuts.init();
	
	[SWF(width=465, height=465, frameRate=30, backgroundColor=0xffffff)]
		
	public class TweenerSample extends Sprite
	{
		public var timer:Timer = new Timer(800);
		public var texts:Array;
		public var textLoader:URLLoader;
		public function TweenerSample() {
			loadText();
			timer.addEventListener(TimerEvent.TIMER, onTimer);
			timer.start();
		}
		
		public function loadText():void {
			Security.loadPolicyFile("http://5ivestar.org/proxy/crossdomain.xml");
			textLoader = new URLLoader();
			textLoader.addEventListener(Event.COMPLETE, completeHandler);
			textLoader.load(new URLRequest("http://5ivestar.org/proxy/http://r7kamura.038shi.lucian.hostingrails.com/ed5-1.txt"));
		}
		public function completeHandler(event:Event):void {
			texts = textLoader.data.split("\n");
			
			texts.pop();
		}
		
		private function onTimer(e:TimerEvent):void
		{
			makeText();
		}
		
		public function makeText():void
		{
			var fld:TextField  = new TextField();
			var tsize:Number   = 10+Math.random()*30;
			var tf:TextFormat  = new TextFormat("MS ゴシック", tsize, 0x000000);
			var ctf:TextFormat = new TextFormat("MS ゴシック", tsize*0.6, 0x000000);
			var index:Number = Math.floor(Math.random()*texts.length);
			var message:String = texts[index].replace(/\,/g, "\n");
			fld.defaultTextFormat = tf;
			fld.autoSize = TextFieldAutoSize.LEFT;
			fld.text = "[c" + index + "]\n" + message;
			fld.setTextFormat(ctf, -1, fld.text.length - message.length);
						
			var bmd:BitmapData = new BitmapData(465, 465, true, 0xffffff);
			bmd.draw(fld);
			var bmp:Bitmap = new Bitmap(bmd);
			addChild(bmp);
			bmp.x = Math.random()*(465 - fld.width);
			bmp.y = Math.random()*(465 - fld.height);
		
			Tweener.addTween(bmp,{
				// 	中心までの距離のうち4割移動して消える
				x: 465/2 - (465/2 - bmp.x)*(1-0.4),
				y: 465/2 - (465/2 - bmp.y)*(1-0.4),
				scaleX:0.6,
				scaleY:0.6,
				alpha: 0,
				time: 2,
				transition: "easeInOutSine",
				_Blur_blurX: 15,
				_Blur_blurY: 15,
				onComplete: onTweenerComplete,
				onCompleteParams: [bmp]
			});
		}
		private function onTweenerComplete(bmp:Bitmap):void
		{
			removeChild(bmp);
		}
	}
}