2 Replies Latest reply on Nov 17, 2006 6:14 AM by Newsgroup_User

    Passing MouseDown events

    Level 7
      I'm hoping that someone out there might be able to give me a few pointers.
      I'm trying to solve a problem in passing mouse down events between sprites.
      The project I'm working on is quite complicated, but in simple terms, I have
      a large rectangular vector sprite on stage, on top of which vector lines are
      drawn. These are created on the fly, and have a behaviour attached which
      includes several mouse events. In certain instances, I want a mouseDown
      event to pass through to the sprite below, so I have used the following

      on mouseDown me
      if the controlDown then
      cursor[member("img_cut2"), member("img_cut2")]
      cursor -1
      m_hiliteArc = false
      end if

      The debugger shows that the correct branch of the if statement is taken and
      pass is executed, but the mousedown handler on the sprite below never gets
      So, does anyone know if there are any known issues with 'pass'? Or is there
      a way to trace where the event is passed to after the handler above? I have
      used put statements in every other mouseDown handler in the movie, and none
      of them are getting called either...

      Thanks in advance for your help

        • 1. Re: Passing MouseDown events
          duckets Level 1
          I believe the 'pass' command passes the event to the next type of event handler, not the next lowest sprite. If you had a moviescript handler called "on mouseDown", it would receive the event.

          I have a script which passes events down to the next sprite which has a behaviour to handle that event. Put the script attached below (on spritePass) into a new movie script (make sure the script cast member is set to type: 'movie').

          Then, instead of calling 'pass' in your behaviour, use this new custom handler:


          This 'spritePass' handler checks downwards through the sprite channels below your current sprite, looking for any behaviour instances which have handlers matching the handler name passed (in this case, #mouseDown). For the first sprite it finds that does, it calls that handler on all behaviours on that sprite which implement it (as is the normal director way).

          hope this helps!

          - Ben
          • 2. Re: Passing MouseDown events
            Level 7
            Ah, so my understanding of the pass command wasnt quite right. Thanks very
            much, I think that will solve my problem, very much appreciated.