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

first

Get Adobe Flash player
by wataru 13 Apr 2009
package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	public class FlashTest extends Sprite {
		public var _r:Number;
		public var _count:Number;
		//
		public function FlashTest() {
			// write as3 code here..
			this.addEventListener(Event.ENTER_FRAME, onEnter, false, 0, true);
			_r = 0;
			_count = 0;
		}
		//
		public function onEnter(e:Event):void {
			//
			if(_count%5 == 0){
				var sp:SimpleShape;
				if (_count % 10 == 0) {
					sp = new SimpleShape(stage.stageWidth, stage.stageHeight,0x000000);
				}else {
					sp = new SimpleShape(stage.stageWidth, stage.stageHeight,0xffffff);
				}
				//
				sp.x = stage.stageWidth * 0.5;
				sp.y = stage.stageHeight * 0.5;
				//
				sp.alpha = 0;
				//
				sp.step = Math.cos(Math.PI / 180*_r)+3;
				//sp.step = 3;
				//
				_r += 10;
				//
				addChildAt(sp, 0);
			}
			_count++;
			//
			//
			if (numChildren > 100) {
				this.removeEventListener(Event.ENTER_FRAME, onEnter, false);
			}
			//
			var removeList:Array = [];
			//
			for (var i:int = 0; i < numChildren; i++) {
				if (getChildAt(i) is SimpleShape) {
					sp = getChildAt(i) as SimpleShape;
					sp.update();
					//
					if (sp.scaleX < 0.05) {
						removeList.push(sp);
					}
				}
			}
			//
			while (removeList.length) {
				sp = removeList.shift() as SimpleShape;
				removeChild(sp);
			}
		}
	}
}
//
class SimpleShape extends flash.display.Sprite {
	public var step:Number;
	//
	public function SimpleShape(w:Number,h:Number,col:uint) {
		graphics.beginFill(col);
		graphics.drawRect(w*-0.5, h*-0.5, w, h);
		graphics.endFill();
	}
	//
	public function update():void {
		width -= step;
		scaleY = scaleX;
		//
		alpha = Math.min(1, alpha + 0.1);
	}
}