Adding Text/Link/InlineGraphic to middle of TextFlow
I have a text flow object that I want to add more FlowElements to. I want the FlowElements to be added to the last place the user clicked in the text flow.
What I've tried is below.
I create an xml object and add a link, image and some spans to a paragraph and then try to add it to the text flow that is already displaied.
private function addNewText()
{
var xml:XML = new XML(
<p>
<a href="www.byu.edu" target="_self" >
<img height="auto" width="auto" source="http://www.insideria.com/riaimages/rss_icon.
</a>
<span>There are many </span>
<span fontStyle="italic">such </span>
<span>lime-kilns in that tract of country, for the purpose of burning the white</span></p>
);
var text:TextFlow = textArea.textFlow;//Get the current text flow from the text area.
var newtext:TextFlow = TextFlowUtil.importFromXML(xml); //create a new text flow with the xml.
var split:FlowElement = text.splitAtPosition(addAt);//split the current text flow at the last place the mouse/(blinky add text here icon) was.
var t:TextFlow = new TextFlow();//create an empty flow
t.addChild(split);//I think this should add the first part.
t.addChild(newtext.getChildAtIndex(0));//I think this should add the new stuff
t.addChild(text);//I think this should the old end stuff.
textArea.textFlow = t;//display it.
I know I'm not doing something right. I've only been using TLF for 2 days now so any help would be great.
