2 Replies Latest reply on Sep 15, 2010 8:45 PM by asdfmnwerli

    Dynamic Object Reference (Flex 4/AS3)

    asdfmnwerli

      Hello,

       

      I currently working on a jigsaw puzzle game using Flex 4.  I have created a puzzle object which is simply a group containing all of my pieces.  When the puzzle object is created it dynamically create all of my pieces using as3.

       

      Where my problem occurs is in moving the pieces around the puzzle area.  My pieces are kind of complex.  The tree goes BorderContainer > Group > Image.  This format is important for the pieces to contain the correct portion of the image.  I noticed through some debugging I have already done that, somewhat obviously, clicking the image for a piece generates an image click event, not a border container click event.  This is important because when I move the pieces I want to move the border container.

       

      So given that the click event target would become the image I click on, any suggestions to access the border container in the click event.  Again the end goal is to move the border container.

       

      Fyi:  I have already tried the phrase "event.target.parent.parent", the first parent being the group, the second the border container.  but as3 doesnt understand the second parent reference, so it returns the group.  So I cannot reference the border container to use to startDrag function.  Also, this means i cannot move the selected piece to the front of the UI.

       

      Thanks for any replies in advance .