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

回るぬ forked from: 回る十字

ときどき め
Get Adobe Flash player
by undo 26 May 2011
/**
 * Copyright undo ( http://wonderfl.net/user/undo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/89CI
 */

// forked from yuugurenote's 回る十字
package {
    import flash.text.TextFormat;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    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 {
        private var sw:Number=stage.stageWidth;
        private 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);
    
    var tf:TextField = new TextField();
    tf.autoSize = TextFieldAutoSize.LEFT;
    var format:TextFormat = new TextFormat(null,16);
    tf.defaultTextFormat = format;
    tf.text = (Math.random()>0.1)?'ぬ':'め';
    var bmd:BitmapData = new BitmapData(tf.width, tf.height, true, 0x00000000);
    bmd.draw(tf);
    var bm:Bitmap = new Bitmap(bmd);
    bm.smoothing = true;
    bm.x = -bm.width/2;
    bm.y = -bm.height/2;
    mySprite.addChild(bm);

    //ランダムカラー
    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);
        }
    }

}      
        }
    }
}