8 Replies Latest reply on Sep 12, 2007 3:05 AM by Newsgroup_User

    mouse events on invisible sprites

    JanvanC
      I have some textsprites with three behaviours on it, from which one has mousedown and mouseup events. The strange thing is that these events are received even when the sprite is invisible. Is it possible that something in my code creates this?

      When I remove the three behaviours and replace them with a very simple behaviour with a mousedown handler, this handler is not executed when the sprite is invisible.
        • 1. Re: mouse events on invisible sprites
          Level 7
          Your second paragraph points toward something in your code. If you post
          your code it will be easier to find the issue.

          --
          Craig Wollman
          Lingo Specialist
          Word of Mouth Productions
          212-928-9581

          www.wordofmouthpros.com
          "JanvanC" <webforumsuser@macromedia.com> wrote in message
          news:fc1sbe$egh$1@forums.macromedia.com...
          >I have some textsprites with three behaviours on it, from which one has
          > mousedown and mouseup events. The strange thing is that these events are
          > received even when the sprite is invisible. Is it possible
          > that
          > something in my code creates this?
          >
          > When I remove the three behaviours and replace them with a very simple
          > behaviour with a mousedown handler, this handler is not executed
          > when
          > the sprite is invisible.
          >
          >


          • 2. Re: mouse events on invisible sprites
            JanvanC Level 1
            The second paragraph is about a behaviour that works normal (in the way that I expect) namely: no execution of code in the mousedown event when the sprite is invisible.

            The problem is mentioned in the first paragraph: a textsprite (with a combination of three behaviours), from which the mousedown and mouseup events execute even when the sprite is invisible.
            Before I bother you with the behaviours, I would like to know if there could be any general reason (not lying in my behaviours), that could cause the execution of mousedown on an invisible sprite.

            Jan
            • 3. Re: mouse events on invisible sprites
              Level 7
              I understood your post. I don't know offhand of anything other than your
              code that would create the issue you mentioned.

              If you don't get a satisfactory answer, I'd be happy to look at the
              suspicious code.


              --
              Craig Wollman
              Lingo Specialist
              Word of Mouth Productions
              212-928-9581

              www.wordofmouthpros.com
              "JanvanC" <webforumsuser@macromedia.com> wrote in message
              news:fc3shc$p5i$1@forums.macromedia.com...
              > The second paragraph is about a behaviour that works normal (in the way
              > that I
              > expect) namely: no execution of code in the mousedown event when the
              > sprite is
              > invisible.
              >
              > The problem is mentioned in the first paragraph: a textsprite (with a
              > combination of three behaviours), from which the mousedown and mouseup
              > events
              > execute even when the sprite is invisible.
              > Before I bother you with the behaviours, I would like to know if there
              > could
              > be any general reason (not lying in my behaviours), that could cause the
              > execution of mousedown on an invisible sprite.
              >
              > Jan
              >


              • 4. Re: mouse events on invisible sprites
                JanvanC Level 1
                I nailed it down. It is the moveablesprite property

                in my begnsprite handler I had this:

                if (myCondition = false) then
                psprite.visible = false
                end if

                and a little bit further (off course only meant for the visible sprites)


                off course an unlogical combination, but by the time I wrote it didn't think that it could have this consequence.

                I should have written:
                if (myCondition = true) then
                psprite.moveablesprite = true
                else
                psprite.visible = false
                end if

                But apart from that, it looks like a bug to me.

                So to put it shortly:

                a sprite with this behaviour:

                property pSprite

                on beginSprite me
                pSprite = sprite (me.spriteNum)
                psprite.visible = false
                psprite.moveablesprite = true
                end

                on mousedown me
                beep
                end

                gives a beep when you click on its (invisible) rect
                • 5. Re: mouse events on invisible sprites
                  JanvanC Level 1
                  a line is missing in my previous post

                  after:
                  "and a little bit further (off course only meant for the visible sprites):"

                  I had meant to write:
                  "psprite.moveablesprite = true"
                  • 6. Re: mouse events on invisible sprites
                    Level 7

                    "JanvanC" <webforumsuser@macromedia.com> wrote in message
                    news:fc49j6$aho$1@forums.macromedia.com...
                    >a line is missing in my previous post
                    >
                    > after:
                    > "and a little bit further (off course only meant for the visible
                    > sprites):"
                    >
                    > I had meant to write:
                    > "psprite.moveablesprite = true"

                    Does it make a difference if you set the moveable to false?
                    And what if you set the moveable first and then set the visible?

                    Richard.


                    • 7. Re: mouse events on invisible sprites
                      JanvanC Level 1
                      Don't get me wrong - I already solved my problem by only setting the moveablesprite property to true when the sprite has to be visible.

                      Still it looks to me like a bug.

                      try the following behaviour on a sprite and you will notice. Wether you set the moveablesprite property before or after the visibility doesn't matter. You will hear the beep. When you set the moveablesprite property to false, the beep is gone.

                      property pSprite


                      on beginSprite me
                      pSprite = sprite (me.spriteNum)
                      psprite.moveablesprite = true
                      psprite.visible = false
                      end

                      on mousedown me
                      beep
                      end
                      • 8. Re: mouse events on invisible sprites
                        Level 7
                        You're right. Fascinatig. I have no explanation.


                        --
                        Craig Wollman
                        Lingo Specialist
                        Word of Mouth Productions
                        212-928-9581

                        www.wordofmouthpros.com
                        "JanvanC" <webforumsuser@macromedia.com> wrote in message
                        news:fc5gva$laf$1@forums.macromedia.com...
                        > Don't get me wrong - I already solved my problem by only setting the
                        > moveablesprite property to true when the sprite has to be visible.
                        >
                        > Still it looks to me like a bug.
                        >
                        > try the following behaviour on a sprite and you will notice. Wether you
                        > set
                        > the moveablesprite property before or after the visibility doesn't matter.
                        > You
                        > will hear the beep. When you set the moveablesprite property to false, the
                        > beep
                        > is gone.
                        >
                        > property pSprite
                        >
                        >
                        > on beginSprite me
                        > pSprite = sprite (me.spriteNum)
                        > psprite.moveablesprite = true
                        > psprite.visible = false
                        > end
                        >
                        > on mousedown me
                        > beep
                        > end
                        >