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: forked from: forked from: Grid Rotation

MainStage
Get Adobe Flash player
by hashito 20 Feb 2010
    Embed
/**
 * Copyright hashito ( http://wonderfl.net/user/hashito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/7Hru
 */

// forked from hashito's forked from: forked from: Grid Rotation
// forked from OkachimachiRiri's forked from: Grid Rotation
// forked from devm's Grid Rotation
// MainStage
package {
	import flash.display.Sprite;
	[SWF(frameRate=60,width=456,height=456)]
	public class MainStage extends Sprite {
		public function MainStage(){
			addChild(new Main());
		}
	}
}


import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.BlendMode;
import flash.filters.BlurFilter;
import flash.geom.Point;
import flash.geom.ColorTransform;
import flash.events.Event;
import net.hires.debug.Stats;


class Main extends Sprite{
	private var _canvas : BitmapData;
	private var _show : Sprite;
	private var _mouseObj:Sprite;
	//Constructor
	public function Main() {addEventListener(Event.ADDED_TO_STAGE, init);}
	//init
	public function init(e:*):void{
		//canvas object init
		_canvas = new BitmapData( stage.stageWidth, stage.stageHeight, false, 0);
		addChildAt( new Bitmap( _canvas ) ,0);
		//mouse object init
		_mouseObj = new Sprite();
		_mouseObj.graphics.beginFill(0xffffff);
		_mouseObj.graphics.drawRect(0,0,100,100);
		_mouseObj.graphics.endFill();
		//show object init
		_show = new Sprite()
		_show.addChild(_mouseObj); 
		//events
		addEventListener( Event.ENTER_FRAME, update );
		var s:Stats = new Stats();
		addChild(s);
	}
	//the loop
	private function update( evt:Event ) : void {
		_mouseObj.x=mouseX;
		_mouseObj.y=mouseY;
		_canvas.colorTransform( _canvas.rect, new ColorTransform( 0.99, 0.99, 0.99 ) );
		_canvas.applyFilter(_canvas, _canvas.rect, new Point(), new BlurFilter(2, 2));
		_canvas.draw( _show );
	}
}