A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: event on child not parent

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    996

    event on child not parent

    I'm trying to place an event on a child and not the parent but it doesn't seem to trigger the event.

    example.
    Code:
    parent.child.buttonMode = true;
    
    parent.child.addEventListener(MouseEvent.ROLL_OVER, onMouseOver );
    
    		
    	private function onMouseOver(evt : MouseEvent) : void
    		{
    			trace("child = "+evt.target.name);
    		}
    The above event is not getting fired.

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    996
    Figured out why it was not firing. There was other children above the child I was targeting. I had to turn off the other children first.

    In the below code I made both the dark_overlay child and the glass child to not except events. that did the trick.

    Code:
    			item.background.buttonMode = true;
    			item.dark_overlay.mouseEnabled= false;
    			item.glass.mouseEnabled = false
    			item.background.addEventListener(MouseEvent.ROLL_OVER, onMouseOver );

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center