title: localToGlobal/globalToLocal AS3 confusion
body: <p>I want to move a display object from one container to another, but have it appear in the same place on screen.</p>
  
  <p>I thought I'd understood this years ago, but the following does not work:</p>
  
  <pre><code>function moveToNewContainer(obj:DisplayObject, newParent:DisplayObjectContainer):void {
      var pos:Point = new Point(obj.x, obj.y);
      var currentParent:DisplayObjectContainer = obj.parent;
      pos = currentParent.localToGlobal(pos);
      currentParent.removeChild(obj);
      newParent.addChild(obj);
      pos = newParent.globalToLocal(pos);
      obj.x = pos.x;
      obj.y = pos.y;
  }
  </code></pre>
  
  <p>This doesn't position the object in the same place as I would have expected.</p>
  
  <p>Does anyone know what I am doing wrong, please?</p>
  
  <p>Thanks,
  James</p>