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: Hit Test Ring

Get Adobe Flash player
by bkzen 09 Jan 2011
/**
 * Copyright bkzen ( http://wonderfl.net/user/bkzen )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/iTFq
 */

// forked from shapevent's Hit Test Ring
package {
    import flash.events.MouseEvent;
    import flash.geom.ColorTransform;
    import flash.display.Graphics;
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class FlashTest extends Sprite {
        private var ring: Sprite;
        private var colorTf:ColorTransform;
        private var overColorTf:ColorTransform;
        
        public function FlashTest() {
            addChild(ring = new Sprite());
            var g:Graphics = ring.graphics;
            g.beginFill(0x000000);
            g.drawCircle(0, 0, 200);
            g.drawCircle(0, 0, 100);
            g.endFill();
            ring.x = stage.stageWidth >> 1, ring.y = stage.stageHeight >> 1;
            overColorTf = new ColorTransform(1, 1, 1, 1, 0xFF);
            colorTf = new ColorTransform();
            ring.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
            ring.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
        }
        private function onMouseOut(e:MouseEvent):void
        {
            ring.transform.colorTransform = colorTf;
        }
        private function onMouseOver(e:MouseEvent):void
        {
            ring.transform.colorTransform = overColorTf;
        }
    }
}