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: 四方向からのテキストアニメーション

四方向から来るテキストアニメーション
参考→http://citizen.jp/arakigallery/
forked::上からだけ文字が落ちてくるようにグレードダウンしてみた
// forked from yanbaka's 四方向からのテキストアニメーション
// 四方向から来るテキストアニメーション
// 参考→http://citizen.jp/arakigallery/
//
// forked::上からだけ文字が落ちてくるようにグレードダウンしてみた
package
{
	import caurina.transitions.Tweener;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	
	[SWF(width = "465", height = "465", backgroundColor = "0xFFFFFF", frameRate = "30")]
	public class EveryDirectionT extends Sprite
	{
		private const txt:String = "じゅげむじゅげむごごうのすりきれかいじゃりすいぎょ";
		private const tran:String = "easeOutElastic";
		private var tfList:Array = [];
		private var margin:Point = new Point(35, 200);
		private var cnt:uint;
		private var xpos:Number = 0;
		private var xposList:Array = [];
		
		
		public function EveryDirectionT():void
		{
			setText();
	                setPoint()
			addEventListener(Event.ENTER_FRAME, onEnterHandler);
			stage.addEventListener(MouseEvent.CLICK, restart);
		}
		
		private function restart(e:MouseEvent):void
		{
                        setPoint()
			addEventListener(Event.ENTER_FRAME, onEnterHandler);
		}
		
		private function setText():void
		{
			for (var i:uint=0; i<txt.length; i++)
			{
				var bmp:Bitmap = createText(txt.charAt(i));
				addChild(bmp);
				tfList.push(bmp);
			}
		}
		
		private function setPoint():void
		{
			cnt = 0;
			xpos = 0;
			xposList = [];
			Tweener.removeAllTweens();
			removeEventListener(Event.ENTER_FRAME, onEnterHandler);
			
			var point:Point;
			for each(var value:Bitmap in tfList)
			{
				value.alpha = 0.0;
                                value.x = xpos + value.width;
                                value.y = 0;
				xposList.push(xpos);
				xpos += value.width;
			}
		}
		
		private function onEnterHandler(e:Event):void
		{
			if(cnt < tfList.length)
			{
				Tweener.addTween(tfList[cnt], {delay:cnt*0.05, alpha:1.0, x:xposList[cnt] + margin.x, y:margin.y, time:0.5, transition:"easeoutback"});
			}
			else
			{
				removeEventListener(Event.ENTER_FRAME, onEnterHandler);
			}
			cnt++;
		}
		
		private function createText(value:String):Bitmap
		{
			var tf:TextField = new TextField();
			tf.autoSize = TextFieldAutoSize.LEFT;
			tf.text = value;
			var bmd:BitmapData = new BitmapData(tf.width, tf.height, true, 0x000000);
			bmd.draw(tf);
			var bmp:Bitmap = new Bitmap(bmd);
			
			return bmp;
		}
	}
}