Skip to main content
Participating Frequently
Apr 15, 2011 4:44 PM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
Jin-HuangCorrect answer
Adobe Employee
Apr 16, 2011 7:26 AM UTC

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.

3 replies

Jin-HuangCorrect answer
Adobe Employee
Apr 16, 2011 7:26 AM UTC

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.

Translate
DilipShahAuthor
Participating Frequently
Apr 16, 2011 5:10 PM UTC

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!

Translate
Adobe Employee
Apr 17, 2011 9:43 AM UTC

Just a joke.

I always see your questions in the forum recently.

Translate