1 Reply Latest reply on Nov 21, 2008 3:53 PM by Newsgroup_User

    AS3 event model broken?

    Roland_G
      Recently I posted a question on this forum regarding the mouseclick event. After some experimenting I finally figured out that the AS3 event model might be broken.
      I include two classes to illustrate my point.
      The first has a sprite inside a sprite. The inside sprite has a box drawn in it. As expected when clicking the box you get two click events, one for the inside sprite and one for the outside one.
      The second has exactly the same structure, yet you only get one click event(for the outside sprite). What changed in the second is that I rearranged the structure of the display list so that my class ClickTest2 becomes the inner sprite.

      How can we explain this behaviour? My only suspicion is that somehow the basic class of the application although being a sprite is treated in a special manner.
        • 1. Re: AS3 event model broken?
          Level 7

          "Roland G" <webforumsuser@macromedia.com> wrote in message
          news:gg7alf$sgj$1@forums.macromedia.com...
          > Recently I posted a
          > http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=58
          > 5&threadid=1407048&enterthread=y on this forum regarding the mouseclick
          > event.
          > After some experimenting I finally figured out that the AS3 event model
          > might
          > be broken.
          > I include two classes to illustrate my point.
          > The first has a sprite inside a sprite. The inside sprite has a box drawn
          > in
          > it. As expected when clicking the box you get two click events, one for
          > the
          > inside sprite and one for the outside one.
          > The second has exactly the same structure, yet you only get one click
          > event(for the outside sprite). What changed in the second is that I
          > rearranged
          > the structure of the display list so that my class ClickTest2 becomes the
          > inner
          > sprite.
          >
          > How can we explain this behaviour? My only suspicion is that somehow the
          > basic
          > class of the application although being a sprite is treated in a special
          > manner.

          I'm really amazed that having an object remove itself from the stage and
          reparent itself works at all. It's not surprising that screws stuff up.