Skip to main content
March 12, 2010
Answered

How do you get an InlineGraphicElement's x y position after composition?

  • March 12, 2010
  • 1 reply
  • 687 views

Anyone have a solution to get a InlineGraphicElement's x y position relative to the container after composition?

I can reference the element's graphic property which returns the displayObject.  From there I tried using the getBounds method, but coordinates it returns seems off.

Basically, I have a sprite in the textFlow that is an InlineGraphicElement.  I want to place a Flex UIComponent over the sprite after composition.

Thanks.

This topic has been closed for replies.
Correct answer Abhi.G.

getBounds may be off it something in your sprite's display hierarchy (for example, the containing TextLine) is not on stage yet. You might have better luck using it when update completes (rather than when composition completes).

Hope this helps.

Abhishek

Adobe Systems Inc.

1 reply

Abhi.G.Correct answer
Participating Frequently
March 12, 2010

getBounds may be off it something in your sprite's display hierarchy (for example, the containing TextLine) is not on stage yet. You might have better luck using it when update completes (rather than when composition completes).

Hope this helps.

Abhishek

Adobe Systems Inc.

March 12, 2010

Yep, thats the approach I took to get it to work.  Once I figured out the composition didn't actually put the TextLines on the container, I made quick progress.

Basically, you loop over the TextLines looking for where your GraphicElement resides.  Then I took a combination of the TextLine's xy coordinates and GraphicElement's xy coordinates to position the UIComponents accordingly.

Perhaps we need a UIComponentElement akin to GraphicElement, which can map to a UIComponent ^_^.