there are several ways to combat this but i think what you want to use is
ROLL_OVER and ROLL_OUT on the parent instead of the MOUSE_OVER and
MOUSE_OUT.  rollover and rollout are different as rollover ignores the
children, check out this post

http://www.kirupa.com/forum/showthread.php?p=1948052

<http://www.kirupa.com/forum/showthread.php?p=1948052>other than that you
can try mouseChildren = false on the parent sprite if you don't care about
the stuff inside having mouseevent properties

greg

On Sun, Mar 28, 2010 at 8: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

Reply via email to