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 10 Aug 2011
/**
 * Copyright yuugurenote ( http://wonderfl.net/user/yuugurenote )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2CIF
 */

package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.Rectangle;
    import flash.display.DisplayObject;
   [SWF(width=465,height=465,backgroundColor=0x1F1F1F,frameRate=60)]

    public class Main110809_01 extends Sprite {
        public var sw:Number=stage.stageWidth;
        public var sh:Number=stage.stageHeight;

        public var myLine:_myLine;
        public var myRect:_myRect;
        public var myRect2:_myRect;
        public var myRect_Ar:Array = new Array();
        public var myRect_Ar2:Array = new Array();

        public var Flag_r:Boolean=false;

        public function Main110809_01() {

            //ラインを配置
            myLine=new _myLine  ;
            myLine.x=0;
            myLine.y=0;
            addChild(myLine);

            addEventListener(Event.ENTER_FRAME,xEnter);
            stage.addEventListener(MouseEvent.MOUSE_MOVE,xMouseDown);

        }

        public function xMouseDown(e:MouseEvent):void {
            myRect = new _myRect();
            myRect.x=mouseX;
            myRect.y=mouseY;
            addChild(myRect);
            myRect_Ar.push(myRect);

            myRect2 = new _myRect();
            myRect2.x=mouseX;
            myRect2.y=mouseY;
            addChild(myRect2);
            myRect_Ar2.push(myRect2);

        }

        public function xEnter(e:Event):void {
            for (var i:Number=0; i<myRect_Ar.length; i++) {
                myChk(myRect_Ar[i],myRect_Ar2[i]);
            }
        }

        private function myChk(ActiveSprite:Sprite,block:Sprite) {
            var dx:Number=myLine.x-ActiveSprite.x;
            if (Math.abs(dx)<1) {
                ActiveSprite.addEventListener(Event.ENTER_FRAME,xEnter2);
            }
            function xEnter2(e:Event):void {
                ActiveSprite.scaleX+=0.1;
                ActiveSprite.scaleY+=0.1;
                ActiveSprite.x-=0.5;
                ActiveSprite.y-=0.5;
                ActiveSprite.alpha-=0.01;
                ActiveSprite.rotation -= 1; //回転するとまた少し違った感じになったりします?
                block.alpha-=0.0099;
                block.rotation += 1;

                if (block.alpha<0) {
                    ActiveSprite.removeEventListener(Event.ENTER_FRAME,xEnter2);
                }
            }
        }
    }
}
import flash.display.Sprite;
import flash.events.Event;

class _myRect extends Sprite {
    public var Flag_r:Boolean=false;
    public var radius:Number=10;
    public var col:Number = 0xFFFFFF * Math.random();
    public var r:Number;

    public function _myRect() {
        graphics.lineStyle(1,col,1,false,"none");
        graphics.drawRect(0,0,radius,radius);
    }
}


class _myLine extends Sprite {

    public function _myLine() {

        graphics.lineStyle(1,0xCCCCCC,1,false,"none");
        graphics.drawRect(0,0,0.1,465);

        this.addEventListener(Event.ENTER_FRAME,xLine);

    }
    private function xLine(e:Event):void {
        this.x+=1;
        if (this.x>stage.stageWidth) {
            this.x=-10;
        }
    }
}