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: ABC

Get Adobe Flash player
by uwi 29 Apr 2010
/**
 * Copyright uwi ( http://wonderfl.net/user/uwi )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/gvxx
 */

// forked from gupon's ABC
package {
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.filters.BitmapFilter;
	import flash.filters.ConvolutionFilter;
	import flash.geom.Matrix;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	[SWF(width=465,height=465,frameRate=5)]
	import flash.utils.Timer;
	public class Test extends Sprite {
		public function Test() {
			function hoge():void {
				A	(	B	(	C	(
				A	(	B	(	C	(
				A	(	B	(	C	(
				A	(	B	(	C	(
				A	(	B	(	C	(
				A	(	B	(	C	(
				A	(	B	(	C	(
				A	(	B	(	C	(
				
				Bitmap(addChild(new Bitmap(
				new BitmapData(465, 465, false)))).bitmapData
				
					)		)		)
					)		)		)
					)		)		)
					)		)		)
					)		)		)
					)		)		)
					)		)		)
					)		)		)
			}
			 
			var timer:Timer = new Timer( 1000 );
			timer.addEventListener( TimerEvent.TIMER, function(event:Event):void {
				if( numChildren ) { 
					var src:Bitmap = Bitmap(getChildAt(0));
					src.bitmapData.dispose();
					removeChild(src);
				}
				hoge();
			});
			timer.start();
		}
		
		
		
		public static function A( b:BitmapData ):BitmapData {
			const w:int = 30 + Math.random() * 100;
			const h:int = 30 + Math.random() * 100;
			const row:int = Math.ceil( 465 / w );
			const col:int = Math.ceil( 465 / h );
			
			const n:int = row * col;
			const rect:Rectangle = new Rectangle(0, 0, w, h);
			b.lock();
			for(var r:int = 1;r < row;r *= 2){
				b.copyPixels( b, new Rectangle(0, 0, w * r, h), new Point( w * r, 0));
			}
			for(var c:int = 1;c < col;c *= 2){
				b.copyPixels( b, new Rectangle(0, 0, 465, h * c), new Point(0, h * c));
			} 
			/*
			for ( var i:int=0;i<n;i++ ) {
				b.copyPixels( b, rect, new Point( i % row * w, h * Math.floor( i / col )));
			}
			*/
			b.unlock();
			return b;
		}
		
		public static function B(c:BitmapData):BitmapData {
			const matrix:Array = [
				 1, -1, -1, -1,  1,
				-1,  1, -1, -1,  1,
				-1, -1,  1, -1,  1,
				-1, -1, -1,  1,  1,
				 1,  1,  1,  1,  1
			];
			
			var divisor:int = 0;
			for each ( var n:int in matrix ) divisor += n;
			const filter:BitmapFilter = new ConvolutionFilter( 5, 5, matrix, divisor, 0, true, true, 0, 0 );
			
			c.lock();
			c.applyFilter( c, c.rect, new Point( 0, 0 ), filter );
			
			var m:Matrix = new Matrix();
			m.rotate(Math.random());
			c.draw( c, m );
			c.unlock();
			return c;
		}
		
		public static function C( a:BitmapData ):BitmapData {
			a.setPixel( 1, 1, Math.random() * 0xFFFFFF );
			return a; 
		}
	}
}