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 13 Jun 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/qAf8
 */

package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    [SWF(width=465,height=465,backgroundColor=0xFFFFFF,frameRate=60)]
    
    public class FlashTest extends Sprite {
        var sw:Number=stage.stageWidth;
        var sh:Number=stage.stageHeight;
        var speed:Number=1;
        
        public function FlashTest() {
       var mySprite:Sprite = new Sprite();
mySprite.graphics.beginFill(0xCCCCCC,0);
mySprite.graphics.drawCircle(0,0,1);
mySprite.graphics.endFill();
addChild(mySprite);

mySprite.addEventListener(Event.ENTER_FRAME,xEnter);
function xEnter(e:Event):void {
    var r:Number=Math.atan2(mouseY-mySprite.y,mouseX-mySprite.x)*180/Math.PI;
    mySprite.x+=speed*Math.cos(r/180*Math.PI);
    mySprite.y+=speed*Math.sin(r/180*Math.PI);
}

var timer:Timer=new Timer(3);
timer.addEventListener(TimerEvent.TIMER,xTimer);
timer.start();

function xTimer(e:TimerEvent):void {
    var myRect:Sprite = new Sprite();
    myRect.graphics.beginFill(0x999999,1);
    myRect.graphics.drawRect(0,0,1,1);
    myRect.graphics.endFill();
    myRect.x=mySprite.x;
    myRect.y=mySprite.y;
    myRect.addEventListener(Event.ENTER_FRAME,xEnter2);
    addChild(myRect);
}
function xEnter2(e:Event):void {
    var myRect:Sprite = e.target as Sprite;
    myRect.alpha -= 0.001;
    if (myRect.alpha < 0) {
        myRect.removeEventListener(Event.ENTER_FRAME,xEnter2);
        removeChild(myRect);
    }
}
            
        }
    }
}