Skip to main content
Participating Frequently
April 15, 2011
Answered

Add an image in Text in TextArea at cursor location via Actionscript and control its baseline

  • April 15, 2011
  • 1 reply
  • 1100 views
If I want to add image at cursor location in TextArea, I need to use EditManager's insertInlineGraphic. But , insertInlineGraphic doesn't offer any parameters for controlling how an image is placed in the text, such as baselineShift.
Whereas InlineGraphicElement allows me fine control over how added image is placed within text via properties such as baselineShift but then there is no way to add this newly created InlineGraphicElement object as cursor location in TextArea!
So, how do you overcome this limitation? How do I add an image in Text in TextArea at cursor location via Actionscript and control its baseline?

Message was edited by: DilipShah

This topic has been closed for replies.
Correct answer Jin-Huang

After the ILG is added, you can find the ILG element by textFlow.findLeaf(cursor location) as InlineGraphicElement, and then change its attributes. Or you may just take advantage of applyLeafFormat().

FindLeaf is an important function for navigation in TLF.

1 reply

Jin-HuangCorrect answer
Adobe Employee
April 16, 2011

After the ILG is added, you can find the ILG element by textFlow.findLeaf(cursor location) as InlineGraphicElement, and then change its attributes. Or you may just take advantage of applyLeafFormat().

FindLeaf is an important function for navigation in TLF.

DilipShahAuthor
Participating Frequently
April 16, 2011

Jin-Huang,

I was going to do what you recommended but I was hoping that there was a

more direct way of handling the situation.

Appreciate all your help.

Dilip

PS: by the way, I'm working on my self-funded 'hobby' project... and I'm the

boss, programmer, sys admin, dba and janitor!

Adobe Employee
April 17, 2011

Just a joke.

I always see your questions in the forum recently.