This is what the ROLL_OVER and ROLL_OUT events are for.
On 4/6/2010 6:11 AM, Ktu wrote:
If none of the children require any mouse events you could always do: parent.mouseChildren = false; Ktu On Sun, Mar 28, 2010 at 11:45 PM, [email protected]< [email protected]> wrote:Hey list, I'm surprised I didn't notice this behaviour sooner, and I wonder how to get around it. Suppose you have a parent sprite and a child sprite. The child is small enough to fit within the parent. The parent has a mouseOut event listener. It seems that the child sprite's mouseOuts are also listened for, although the mouse is still within the parent. Is it possible to listen ONLY for the parent's mouse events, not the child's? Example code: var parentSprite:Sprite = new Sprite(); addChild(parentSprite); parentSprite.graphics.beginFill(0xFF0000); parentSprite.graphics.drawRect(0, 0, 100, 100); parentSprite.name = "parental" var childSprite:Sprite = new Sprite(); parentSprite.addChild(childSprite); childSprite.graphics.beginFill(0x0000FF); childSprite.graphics.drawRect(0, 0, 20, 20); childSprite.x = childSprite.y = 30; childSprite.name = "kiddie"; parentSprite.addEventListener(MouseEvent.MOUSE_OUT, mouseHandler) function mouseHandler (e:MouseEvent):void { trace("e.target.name: " + e.target.name) trace("e.currentTarget.name: " + e.currentTarget.name) trace("") } _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders_______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

