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: ドット絵を描こう

とりあえず出来たらしい。
* ダブルクリックでリセット。
* 使いづらいのでちまちまいじる。
Get Adobe Flash player
by hacker_erpld_yd 28 Apr 2009
    Embed
// forked from sw_lucchini's ドット絵を描こう
/*
 * とりあえず出来たらしい。
 * ダブルクリックでリセット。
 * 使いづらいのでちまちまいじる。
 */

package 
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.display.StageScaleMode;
	import flash.display.StageAlign;
	
	[SWF(width="330", height="330", backgroundColor="0xFFFFFF")]
	public class Main extends Sprite 
	{
		private var shikaku:Rect;
		private var shikakus:Array = new Array();
		
		public function Main():void 
		{
			init();
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = "";
			stage.doubleClickEnabled = true;
			stage.addEventListener(MouseEvent.DOUBLE_CLICK, Clear);
		}
		
		public function init():void {
			var cnt:uint = 0;
			for (var i:uint = 0; i < 30; i++) {
				for (var j:uint = 0; j < 30; j++) {
					shikaku = new Rect();
					shikaku.x = i * shikaku.width + i;
					shikaku.y = j * shikaku.height + j;
					shikaku.z = j * shikaku.height + j;
					shikakus[cnt] = shikaku;
					addChild(shikakus[cnt]);
					cnt++;
				}
			}
		}
		
		private function Clear(e:MouseEvent):void {
			for (var i:uint = 0; i < shikakus.length; i++) {
				removeChild(shikakus[i]);
			}
			init();
		}
		
	}
	
}

import flash.display.Sprite;
import flash.events.MouseEvent;

class Rect extends Sprite {
	
	private var _sp:Sprite;
	
	public function Rect() {
		_sp= new Sprite();
		_sp.graphics.beginFill(0x000000);
		_sp.graphics.drawRect(0, 0, 10, 10);
		_sp.graphics.endFill();
		addChild(_sp);
		
		_sp.addEventListener(MouseEvent.ROLL_OVER, onROver);
		_sp.addEventListener(MouseEvent.ROLL_OUT, onROut);
		_sp.addEventListener(MouseEvent.CLICK, onClickHandler);
	}
	
	private function onROver(e:MouseEvent):void {
		_sp.alpha = 0.5;
	}
	
	private function onROut(e:MouseEvent):void {
		_sp.alpha = 1;
	}
	
	private function onClickHandler(e:MouseEvent):void {
		removeChild(_sp);
	}

}