1 Reply Latest reply on Sep 21, 2007 12:19 PM by JKohn99

    Translation between coordinate systems

    JKohn99 Level 1
      I'm trying to figure out how to get the x/y coordinates of objects in side a canvas container.
      The canvas can be moved around via drag/drop. Once in it's new place I need
      to get the coordinates of all the contained objects (in this case some images).

      If I click directly on the images I can use the event.localX and localY and the localToGlobal
      methods, globalToContent.

      However I'm currently stumped when the new coordinates of the image is the result of
      moving their container.

      If anyone has any suggestions I'd be very helpful.

        • 1. Re: Translation between coordinate systems
          JKohn99 Level 1
          I may have answered my own question. I used the following
          (where this is my contained object and container.parent is the
          drawing canvas).
          var r:Rectangle = this.getBounds(_container.parent);
          I then offset the rect based on the width and height to get to the
          center of my object.

          Any one else have more experience working on this type of problem?