2 Replies Latest reply on Jan 17, 2007 12:03 PM by Newsgroup_User

    Pass event

    Level 7
      Is there a way to make events such as mouseEnter, mouseLeave, mouseWithin,
      etc. work on multiple sprites at the same time? Thus if you're rolling over
      2 sprites at once, a command is passed to both of them, instead of just the
      one on top? I was pretty sure that the "pass" command was supposed to do
      this, but it doesn't seem to do anything at all for these handlers. (It
      really should - would make it a much more useful command.) I know I could
      run a rollover script from a frame handler to get the same effect, but this
      would require individually checking each sprite with the behavior, rather
      than the behaviors handling themselves as they ideally should.
      (Particularly if the number of sprites using the behavior is not a
      constant.) Thus, I want something that works on the behavior script itself,
      rather than being operated by a third party like the frame script or an
      independant movie script. Any suggestions?


        • 1. Re: Pass event
          Level 7
          This is kind of messy, but you can put something like this on the sprite
          (Warning- untested, off-the-top-of-my-head script):

          on mouseUp me
          --do something
          sendAllSprites(#check4Click,the mouseLoc)
          end

          and on the other sprites that need to receive the click,

          on check4Click me, vMouseLoc
          if vMouseLoc.inside(sprite(me.spriteNum).rect) then
          me.mouseUp()
          end if
          end

          Just make sure you don't get into a circular situation where the sprite
          gets both handlers in a loop...
          • 2. Re: Pass event
            Level 7
            If you *have* to:

            on mouseUp me, obj
            if obj=me then exit

            -- add code here.
            put me, obj

            -- if the script is a behavior, the obj.voidP check is required.
            if obj.voidP then sendAllSprites(#mouseUp, me)
            end


            "Darrel Hoffman" <no.address@all.com> wrote in message
            news:eollgf$7rv$1@forums.macromedia.com...
            > Is there a way to make events such as mouseEnter, mouseLeave, mouseWithin,
            > etc. work on multiple sprites at the same time? Thus if you're rolling
            > over
            > 2 sprites at once, a command is passed to both of them, instead of just
            > the
            > one on top? I was pretty sure that the "pass" command was supposed to do
            > this, but it doesn't seem to do anything at all for these handlers. (It
            > really should - would make it a much more useful command.) I know I could
            > run a rollover script from a frame handler to get the same effect, but
            > this
            > would require individually checking each sprite with the behavior, rather
            > than the behaviors handling themselves as they ideally should.
            > (Particularly if the number of sprites using the behavior is not a
            > constant.) Thus, I want something that works on the behavior script
            > itself,
            > rather than being operated by a third party like the frame script or an
            > independant movie script. Any suggestions?
            >
            >