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

ポタポタ

Get Adobe Flash player
by knd 16 Dec 2009
package  
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.geom.ColorTransform;
	public class TestBubble extends Sprite
	{
		private const LW:Number = 1.0;//Line Width
		private var lColor:uint = 0x3f3f3f;
		private var fColor:uint = 0xc0c0c0;
		private var fillGra:Sprite;
		private var lineGra:Sprite;
		private var bm:Bitmap;
		public function TestBubble() 
		{
			bm = new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight, true, 0xffffffff));
			addChild(bm);
			fillGra = new Sprite();
			lineGra = new Sprite();
			addChild(lineGra);
			addChild(fillGra);
			new myTimer(1000).setRepeatAndGo(timer);
			addEventListener(Event.ENTER_FRAME, loop);
		}
		private function timer(e:TimerEvent):void 
		{
			bm.bitmapData.draw(this);
			lineGra.graphics.clear();
			fillGra.graphics.clear();
			var c:uint = ((0x100 * Math.random()) << 16) | ((0x100 * Math.random()) << 8) | (0x100 * Math.random());
			lColor = (c & 0xfcfcfc) >> 2;
			fColor = 0x808080 + ((c & 0xfefefe) >> 1);
		}
		private function loop(e:Event):void 
		{
			var _x:Number = stage.stageWidth * Math.random();
			var _y:Number = stage.stageHeight * Math.random();
			var _r:Number = 100 / (1 + 0.01 * Math.max(Math.abs(_x - stage.stageWidth * 0.5), Math.abs(_y - stage.stageHeight * 0.5))) * Math.random();
			lineGra.graphics.beginFill(lColor);
			lineGra.graphics.drawCircle(_x, _y, _r + LW);
			fillGra.graphics.beginFill(fColor);
			fillGra.graphics.drawCircle(_x, _y, _r);
			_x += 2 * _r * (Math.random()-0.5);
			_y += 2 * _r * (Math.random()-0.5);
			_r *= 0.8 + 0.4 * Math.random();
			lineGra.graphics.beginFill(lColor);
			lineGra.graphics.drawCircle(_x, _y, _r + LW);
			fillGra.graphics.beginFill(fColor);
			fillGra.graphics.drawCircle(_x, _y, _r);
		}
	}
}

	import flash.events.TimerEvent;
	import flash.utils.Timer;
	internal class myTimer extends Timer
	{
		public function myTimer(delay:Number, repeatCount:int = 0) 
		{
			super(delay, repeatCount);
		}
		public function setRepeatAndGo(listener:Function):void
		{
			super.addEventListener(TimerEvent.TIMER, listener);
			super.start();
		}
	}