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

flash on 2009-8-4

Get Adobe Flash player
by iong 04 Aug 2009
    Embed
/**
 * Copyright iong ( http://wonderfl.net/user/iong )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/oDlq
 */

package
{
	import flash.display.Sprite;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.filters.BlurFilter;
	import flash.display.BlendMode;
	import flash.geom.Point;

	import flash.events.Event;
	import flash.display.StageQuality;
	import flash.display.StageScaleMode;
	import flash.display.DisplayObject;

	[SWF(backgroundColor="#FFFFFF")]

	public class As001 extends Sprite
	{
		private var cv:BitmapData;
		private var cP:Sprite;
		private var gS01:Sprite;
		private var mRBlur:BlurFilter;

		public function As001():void
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.quality   = StageQuality.LOW;
			stage.frameRate = 30;

			init();
			stage.addEventListener(Event.ENTER_FRAME, onEF);
		}

		private function init():void
		{
			cv     = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0xffffff);
			cP     = new Sprite();
			mRBlur = new BlurFilter(16, 16);

			this.addChild(new Bitmap(cv));
		}

		// ランダムカラーでcircle描画、ランダムな位置に配置
		private function drawC(n:uint):void
		{
			gS01 = new Sprite();
			cP.addChild(gS01);
			var coC:Number = retC();

			gS01.graphics.beginFill(coC, Math.round(Math.random()*100)/100);
			gS01.graphics.drawCircle(-n/2, -n/2, n);

			cv.draw(cP, null, null, BlendMode.SCREEN);
			cv.applyFilter(cv, cv.rect, new Point(), mRBlur);
			gS01.x = Math.round(Math.random()*stage.stageWidth);
			gS01.y = Math.round(Math.random()*stage.stageHeight);

			if(cP.numChildren==2){
				var target:DisplayObject = cP.getChildAt(0);
				cP.removeChildAt(0);
				target = null;
			}

		}
		
		private function retC():Number
		{
			var coR:String= Math.round(Math.random()*255).toString(16);
			var coG:String= Math.round(Math.random()*255).toString(16);
			var coB:String= Math.round(Math.random()*255).toString(16);
			return parseInt("0x"+coR+coG+coB, 16)
		}

		private function onEF(e:Event):void
		{
			var iR:uint = Math.round(Math.random()*100);
			drawC(iR);
		}
	}
}