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

grass

クリックしたところになにかでてくる
Get Adobe Flash player
by Scmiz 18 Jun 2011
    Embed
/**
 * Copyright Scmiz ( http://wonderfl.net/user/Scmiz )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/jHYl
 */

package {
	import flash.display.Graphics;
    import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
    public class FlashTest extends Sprite {
		private var _array:/*Number*/Array;
		private var _isDown:Boolean;
		
        public function FlashTest() {
			_array = new Array();
			for (var index:uint = 0; index < 10000; ++index) {
				_array.push(0.0);
			}
			
			this.addEventListener(Event.ENTER_FRAME, proc);
			stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
			stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
        }
		
		private function proc(e:Event):void {
			if (_isDown) {
				glow(mouseX, mouseY);
			}
			
			draw();
		}
		
		private function glow(x:Number, y:Number):void {
			var indexX:uint = (x - 34) / 4;
			var indexY:uint = (y - 34) / 4;
			
			
			for (var n:int = -2; n < 3; ++n) {
				for (var m:int = -2; m < 3; ++m) {
					if (m + indexX >= 0 && m + indexX < 100 && n + indexY >= 0 && n + indexY < 100) {
						_array[m + indexX + ((n + indexY) * 100)] += 4.0;
					}
				}
			}
		}
		
		private function draw():void {
			var g:Graphics = this.graphics;
			g.clear();
			
			g.beginFill(0x404040);
			g.drawRect(30, 30, 404, 404);
			g.endFill();
			
			var colors:Array = [0x00f000, 0x00b000, 0x00d000];
			
			for (var index:uint = 0; index < 10000; ++index) {
				if (_array[index] > 0) {
					var indexX:uint = index % 100;
					var indexY:uint = index / 100;
					var posx:uint = 34 + (indexX * 4) + (indexY % 4);
					var posy:uint = 34 + (indexY * 4);
					g.lineStyle(1, colors[(indexX + indexY) % 3]);
					g.moveTo(posx, posy);
					g.lineTo(posx, posy - _array[index]);
				}
			}
		}

		private function onMouseDown(e:MouseEvent):void {
			_isDown = true;
		}

		private function onMouseUp(e:MouseEvent):void {
			_isDown = false;
		}
    }
}