Hi Robin,
I tried this but of no help. It always give me x:0 and y:0 irrespective of image position in TextFlow.
Here is the code that I tried:
private function graphicStatusChangeEvent(evt:StatusChangeEvent):void
{
if(evt.status == InlineGraphicElementStatus.READY)
{
_textFlow.flowComposer.updateAllControllers();
var inlineGraphic:InlineGraphicElement = _textFlow.findLeaf(evt.element.getAbsoluteStart()) as InlineGraphicElement;
Alert.show("x : " + inlineGraphic.graphic.x + "\ny : " + inlineGraphic.graphic.y);
}
}
Regards,
Amandeep Singh
Sorry, you are right. The inline has a parent which handles its positioning. So when you look at the x, y, its 0 relative to its parent. If you were to look at the parent DisplayObject's position, you'd see what it is relative to the TextLine.
To get it in global (stage) coordinates, call globalToLocal() on the (x,y) position of the inline. To get it in coordinates relative to the line, you'd need to take the global coordinates and call textLine.localToGlobal, for the container relative coordinates it would be the same, but use the container instead of the textLine.
Hope this helps,
- robin