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 yuugurenote 16 Jun 2012
    Embed
/**
 * Copyright yuugurenote ( http://wonderfl.net/user/yuugurenote )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/A9jU
 */

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    [SWF(width=465,height=465,backgroundColor=0xFFFFFF,frameRate=60)]
    public class AS120616_01 extends Sprite {
        public var sw:Number=stage.stageWidth;
        public var sh:Number=stage.stageHeight;
        public var _myRect:myRect;
        public var max:Number=200;
        public function AS120616_01() {
            stage.addEventListener(MouseEvent.MOUSE_DOWN,xDown);
        }
        public function xDown(e:MouseEvent):void {
            for (var i:Number=0; i<max; i++) {
                _myRect= new myRect();
                _myRect.x=i%10*46.5;
                _myRect.y=Math.floor(i/10)*46.5;
                addChild(_myRect);
            }
        }
    }
}

import flash.display.Sprite;
class myRect extends Sprite {
    public function myRect() {
        this.graphics.beginFill(Math.random()*0xFFFFFF,1);
        this.graphics.drawRect(0,0,46.5,46.5);
        this.graphics.endFill();
    }
}