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

とりあえず出来たらしい。
ダブルクリックでリセット。
使いづらいのでちまちまいじる。
Get Adobe Flash player
by fukt 09 Oct 2010
    Embed
// forked from Antheor's forked from: ドット絵を描こう
// 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;
                    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;
import flash.geom.*;

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();
        
        var myColor:ColorTransform = _sp.transform.colorTransform;
        var colorArray:Array = new Array(0x00ff00, 0x00000ff, 0x0Ff0000, 0x0fff000, 0x1F52C7, 0x4776E2);
        var randomColorID:Number = Math.floor(Math.random()*colorArray.length);
        randomColorID = Math.floor(Math.random()*colorArray.length);
        myColor.color=colorArray[randomColorID];
        _sp.transform.colorTransform = myColor;
        
        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);
    }

}