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 _wonder 05 Apr 2010
    Embed
/**
 * Copyright _wonder ( http://wonderfl.net/user/_wonder )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/nstT
 */

package {
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class FlashTest extends Sprite {
    	
    		private var arrow:Arrow;
    		
        public function FlashTest() {
            arrow = new Arrow();
            arrow.x = stage.stageWidth / 2;
            arrow.y = stage.stageHeight / 2;
            addChild( arrow );
            
            addEventListener( Event.ENTER_FRAME, onEnterFrame);
        }
        
        private function onEnterFrame(e:Event):void{
        		var dx:Number = mouseX - arrow.x;
        		var dy:Number = mouseY - arrow.y;
        		var rad:Number = Math.atan2( dy, dx );
        		arrow.rotation = rad * 180 / Math.PI;
        }
    }
}

import flash.display.Sprite;

class Arrow extends Sprite{
	public function Arrow(){
		init();
	}
	
	public function init():void{
		graphics.lineStyle(1,0,1);
		graphics.beginFill( 0Xffff00 );
		graphics.moveTo( -50,-25 );
		graphics.lineTo( 0, -25 );
		graphics.lineTo( 0, -50 );
		graphics.lineTo( 50, 0 );
		graphics.lineTo( 0, 50 );
		graphics.lineTo( 0, 25 );
		graphics.lineTo( -50, 25 );
		graphics.lineTo( -50, -25 );
		graphics.endFill();
	}
}