dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Mouse event propagation question

  1. #1
    Member
    Join Date
    Jun 2006
    Location
    Croatia
    Posts
    90

    Question Mouse event propagation question

    Hi guys,

    Let's say i have a following situation:

    I have a "large" movie clip and "small" movie inside a "large" movie clip but on it's let's say upper right corner:

    Code:
    largeMc.addChild(smallMc);
    If i try to catch Mouse.DOWN events on them the following way:

    Code:
    largeMc.addEventListener(MouseEvent.MOUSE_DOWN, largeClicked);
    smallMc.addEventListener(MouseEvent.MOUSE_DOWN, smallClicked);
    Then of course both event are captured no matter where i click.

    Is it possible to capture independent mouse clicks on both of these two movie clips and if so, how can i do that?

    Thanks in advance,
    best regards

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    You can prevent the event propagation by putting this in the script for your smallMc

    smallMc.addEventListener(MouseEvent.MOUSE_DOWN, smallClicked);
    function smallClicked(event:MouseEvent):void
    {
    event.stopPropagation ();
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Member
    Join Date
    Jun 2006
    Location
    Croatia
    Posts
    90
    Awesome, thank you very much cancer

    Cheers

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