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

flash on 2011-11-28

Get Adobe Flash player
by Bhavesh 28 Nov 2011
    Embed
/**
 * Copyright Bhavesh ( http://wonderfl.net/user/Bhavesh )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/sSQD
 */

package{
    import flash.display.BlendMode;
    import flash.display.CapsStyle;
    import flash.display.LineScaleMode;
    import flash.display.Stage;
    import flash.display.Graphics;
    import flash.ui.Mouse;
    import flash.events.Event;
    import flash.display.Sprite;
    
    
    [SWF(width = "500", height = "500",frameRate="30",backgroundColor="#000000")]
    
    public class ch12 extends Sprite{
        protected var compass:Sprite;
        protected var crossharis:Sprite;
        public function ch12(){
            drawCompass();
            drawCorsshairs();
            addEventListener(Event.ENTER_FRAME,tick);
        }
        protected function tick(event:Event):void{
            Mouse.hide();
            crossharis.x = stage.mouseX;
            crossharis.y = stage.mouseY;
            compass.rotation = Math.atan2(stage.mouseY - compass.y,stage.mouseX - compass.x) * 180 / Math.PI;  
        }
        protected function drawCompass():void{
            var RADIUS:Number = 30;
            compass = new Sprite();
            var g:Graphics = compass.graphics;
            g.lineStyle(4,0xe03030);
            g.beginFill(0xd0d0d0);
            g.drawCircle(0,0,RADIUS);
            g.endFill();
            g.moveTo(0,0);
            g.lineTo(RADIUS,0);
            addChild(compass);
            compass.x = stage.stageWidth / 2;
            compass.y = stage.stageWidth  / 2;
        }
        protected function drawCorsshairs():void{
            var SIZE:Number = 10;
            crossharis = new Sprite();
            var g:Graphics = crossharis.graphics;
            g.lineStyle(8,0x4040f0,1,false,LineScaleMode.NONE,CapsStyle.SQUARE);
            g.moveTo(0,SIZE);
            g.lineTo(0,-SIZE);
            g.moveTo(SIZE,0);
            g.lineTo(-SIZE , 0);
            crossharis.blendMode = BlendMode.MULTIPLY;
            addChild(crossharis);
        }

    }

}