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

Dots

Get Adobe Flash player
by seagirl 17 Dec 2008
// write as3 code here..
package {
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Point;

	[SWF(backgroundColor="#FFFFFF")]
	
	public class Dots extends Sprite
	{
		public function Dots()
		{
			init();
		}
		
		private var bitmap:Bitmap;
		private var canvas:BitmapData;
		
		private var point:Point = new Point(0, 0);
		
		private function init():void
		{
			stage.frameRate = 30;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			canvas = new BitmapData(stage.stageWidth, stage.stageHeight);
			bitmap = new Bitmap(canvas);
			addChild(bitmap);
			
			addEventListener(Event.ENTER_FRAME, enterFrameHandler);
		}
		
		private function enterFrameHandler(event:Event):void
		{
			new Array(30000).forEach(
				function (e:*, i:int, a:Array):void
				{
					var color:uint = (point.x * point.y % 2) ? 0x000000 : 0xEEEEEE;
					
					canvas.setPixel(point.x, point.y, color);
										
					point.x++;
			
					if (point.x % canvas.width == 0)
					{
						point.x = 0;
						point.y++;
						
						if (point.y % canvas.height == 0)
							removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
					}
				}
			);
		}
		
	}
}