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

package {
    import flash.display.Sprite;
    import flash.display.Graphics;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.geom.ColorTransform;
    [SWF(width=465,height=465,backgroundColor=0x000000,frameRate=60)]

    public class AS111101_01 extends Sprite {
        public var sw:Number=stage.stageWidth;
        public var sh:Number=stage.stageHeight;
        public var myColor:ColorTransform = new ColorTransform();
        public var viewBmd:BitmapData=new BitmapData(sw,sh,false,0x000000);
        public var viewBmp:Bitmap=new Bitmap(viewBmd);
        public var _myCircleAlpha0:myCircleAlpha0;

        public function AS111101_01() {

            addChild(viewBmp);
            var tmpBmd:BitmapData;
            myColor.redMultiplier=0.999;
            myColor.greenMultiplier=0.999;
            myColor.blueMultiplier=0.999;
            addEventListener(Event.ENTER_FRAME,xDraw);
            stage.addEventListener(MouseEvent.MOUSE_DOWN,xEnter1);
        }
        public function xDraw(e:Event):void {
            viewBmd.draw(stage,null,myColor);
        }
        public function xEnter1(e:Event):void {
            _myCircleAlpha0 = new myCircleAlpha0();
            _myCircleAlpha0.x=sw/2;
            _myCircleAlpha0.y=sh/2;
            addChild(_myCircleAlpha0);
        }
    }
}

import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filters.BlurFilter;

class myCircleAlpha0 extends Sprite {

    public var radius:Number;
    public var speedX:Number=Math.random()*3 + 1;
    public var speedY:Number=Math.random()*3;
    public var myColor2:ColorTransform = new ColorTransform();
    public var myFil:BlurFilter=new BlurFilter(4,4,2);

    public function myCircleAlpha0() {

        this.graphics.beginFill(0x00FFFF,1);
        this.graphics.drawCircle(0,0,4);
        this.graphics.endFill();

        myColor2.color=Math.random()*0xffffff;
        this.transform.colorTransform=myColor2;
        this.filters=[myFil];
        
        this.addEventListener(Event.ENTER_FRAME,xEnter2);

    }

    public function xEnter2(e:Event):void {
        radius=this.width/2;
        this.x+=speedX;
        this.y+=speedY;
        this.rotation += 1;

        if (this.x+radius>stage.stageWidth) {
            this.x=stage.stageWidth-radius;
            speedX=- speedX;
        }
        if (this.x-radius<0) {
            this.x=radius;
            speedX=- speedX;
        }
        if (this.y+radius>stage.stageHeight) {
            this.y=stage.stageHeight-radius;
            speedY=- speedY;
        }
        if (this.y-radius<0) {
            this.y=radius;
            speedY=- speedY;
        }
    }
}