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

code on 2008-12-28

// write as3 code here..
Get Adobe Flash player
by 269 28 Dec 2008
// write as3 code here..// write as3 code here..
package  {
	import flash.display.Sprite;
	import flash.events.TimerEvent;
	import flash.text.TextField;
	import flash.utils.Timer;
	
	/**
	* ...
	* @author Default
	*/
        [SWF(backgroundColor="0x000000", frameRate="60")] 
	public class Main extends Sprite{
		private var _dt:DancingText;
		private var _timer:Timer;
		private var _executeTimerNum:int = 3;

		public function Main() {
			var _root = root;
			_dt = new DancingText(_root);
			_dt.init();
			_timer = new Timer(_executeTimerNum, 0);
			_timer.addEventListener("timer", txtGenerate);
			_timer.start();
		}
		
		private function txtGenerate(_evt:TimerEvent):void {
			if (numChildren != 0) removeChildAt(0);
			_dt.init();
			addChild(_dt.textField);
			_timer.removeEventListener("timer", txtGenerate);
			_timer = null;
			_timer = new Timer(_executeTimerNum, 0);
			_timer.addEventListener("timer", txtGenerate);
			_timer.start();
		}
		
	}
	
}	
	import flash.filters.BlurFilter;
	import flash.filters.GlowFilter;
	import flash.text.AntiAliasType;
	import flash.text.Font;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	class DancingText {
		private var _format:TextFormat;
		private var _textField:TextField;
		private var _defaultFontSize:int = 20;
		private var _randomFontSize:int = 200;
		private var _buffer;

public function DancingText(buffer) {
			_buffer = buffer
			setUpText();
			init();
		}
		
		public function init() {
			setUpFilter();
			setText();
			setPosition();
			setTextSize();
		}
		
		private function setTextSize():void{
			_format.size = (Math.random() * _randomFontSize) + _defaultFontSize;
			_textField.setTextFormat(_format);
		}

		private function setUpText():void{
			_format = new TextFormat("Arial");
			_format.color = 0xFFFFFF;
			_format.kerning = true;
			
			_textField = new TextField();
			_textField.autoSize = TextFieldAutoSize.LEFT;
			_textField.defaultTextFormat = _format;
		}
		
		private function setUpFilter():void{
			var glow:GlowFilter = new GlowFilter(0x0099CC, .5, 4, 4, 10,1)
			var blur:BlurFilter = new BlurFilter(Math.random()*4,Math.random()*100,1);
			_textField.filters = [glow,blur];
		}
		
		public function setText() {
			_textField.text = String.fromCharCode((Math.random()*74)+48)
		}
		
		private function setPosition():void{
			_textField.x = Math.random() * _buffer.stage.stageWidth;
			_textField.y = Math.random() * _buffer.stage.stageHeight;
		}
		public function get textField():TextField { return _textField; }
		
		
	}