package com.riapriority.eventstests
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;

    public class ChildSprite extends Sprite
    {
        public function ChildSprite()
        {
            super();
            graphics.beginFill(0x999999);
            graphics.drawRoundRectComplex(100, 100, 200, 200, 10, 10, 10, 10);
            graphics.endFill();
            
            var anOtherChild:Sprite = new Sprite ();
            anOtherChild.graphics.beginFill(0xCCCCCC);
            anOtherChild.graphics.drawRoundRectComplex(150, 150, 100, 100, 10, 10, 10, 10);
            anOtherChild.graphics.endFill();
            addChild(anOtherChild);
            
            anOtherChild.addEventListener(MouseEvent.CLICK, onInsideChildClick);
        }
        
        private function onInsideChildClick (event:MouseEvent):void
        {
            dispatchEvent(new Event ("ourTargetEvent", true));
        }
    }
}