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

package {
    import flash.display.Sprite;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.events.Event;
    import flash.geom.ColorTransform;
    
    [SWF(width=465,height=465,backgroundColor=0x000000,frameRate=60)]
    public class FlashTest extends Sprite {
         
         
         
        public function FlashTest() {
        var timer = new Timer(100);
        timer.start();
        timer.addEventListener(TimerEvent.TIMER,xDown);
            

            // write as3 code here..
            function xDown(e:TimerEvent):void {
            for (var i:Number=0; i < 3; i++) {
            var mySprite:Sprite=makeSprite();
            drowSprite(mySprite);
            }
        }
    
        function makeSprite():Sprite {
        var mySprite:Sprite = new Sprite();
        mySprite.x=Math.floor(Math.random()*stage.stageWidth);
        mySprite.y=Math.floor(Math.random()*stage.stageHeight);
        var px:Number=Math.floor(Math.random()*stage.stageWidth);
        var py:Number=Math.floor(Math.random()*stage.stageHeight);
        var myColor:ColorTransform = new ColorTransform();
        myColor.color=Math.floor(Math.random()*0xFFFFFF);
        mySprite.transform.colorTransform=myColor;
        addChild(mySprite);
        mySprite.addEventListener(Event.ENTER_FRAME,xMove);

        function xMove(e:Event):void {
        mySprite.x += (px - mySprite.x)/80;
        mySprite.y += (py- mySprite.y)/80;

        var dx=py-mySprite.y;

        if (Math.abs(dx)<10) {
            mySprite.alpha-=0.05;
            if (mySprite.alpha<0) {
                mySprite.graphics.clear();
                mySprite.removeEventListener(Event.ENTER_FRAME,xMove);
                removeChild(mySprite);
            }
        }
    }
    return mySprite;
}

function drowSprite(mySprite:Sprite):void {
    mySprite.graphics.beginFill(0xCCCCCC,1);
    mySprite.graphics.drawRect(0,0,1,10);
}
        }
    }
}