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

package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.ColorTransform;    
    [SWF(width=465,height=465,backgroundColor=0xFFFFFF,frameRate=60)]    
 
    public class FlashTest extends Sprite {
        var sw:Number=stage.stageWidth;
        var sh:Number=stage.stageHeight;
        
        public function FlashTest() {
            // write as3 code here..
stage.addEventListener(MouseEvent.MOUSE_MOVE,xMove);
function xMove(e:MouseEvent):void {
    var mySprite:Sprite = new Sprite();
    mySprite.x=mouseX;
    mySprite.y=mouseY;
    addChild(mySprite);

    //1本目
    var c1:Sprite = new Sprite();
    c1.graphics.lineStyle(2,0xCCCCCC,1);
    c1.graphics.moveTo(0,0);
    c1.graphics.lineTo(5,0);
    mySprite.addChild(c1);

    //2本目
    var c2:Sprite = new Sprite();
    c2.graphics.lineStyle(2,0xCCCCCC,1);
    c2.graphics.moveTo(0,0);
    c2.graphics.lineTo(0,5);
    c1.addChild(c2);

    //3本目
    var c3:Sprite = new Sprite();
    c3.graphics.lineStyle(2,0xCCCCCC,1);
    c3.graphics.moveTo(0,0);
    c3.graphics.lineTo(-5,0);
    c2.addChild(c3);

    //4本目
    var c4:Sprite = new Sprite();
    c4.graphics.lineStyle(2,0xCCCCCC,1);
    c4.graphics.moveTo(0,0);
    c4.graphics.lineTo(0,-5);
    c3.addChild(c4);

    //ランダムカラー
    var myColor:ColorTransform = new ColorTransform();
    myColor.color=Math.random()*0xFFFFFF;
    mySprite.transform.colorTransform = myColor;

    //mySpriteの行き先用の数値
    var px:Number=Math.random()*sw;
    var py:Number=Math.random()*sh;

    //mySpriteの動作
    mySprite.addEventListener(Event.ENTER_FRAME,xEnter);
    function xEnter(e:Event):void {
        mySprite.x += (px - mySprite.x)/80;
        mySprite.y += (py - mySprite.y)/80;
        mySprite.rotation += 7;
        mySprite.alpha-=0.01;
        
        if (mySprite.alpha < 0 ) {
            mySprite.removeEventListener(Event.ENTER_FRAME,xEnter);
            removeChild(mySprite);
        }
    }

}      
        }
    }
}