The terminator with width is necessary for TLF otherwise we can not tell which paragraph the cursor is in when runtime. I think that's a common method for most editor.
The terminator in TLF is appended this way:
1) If the last leafElement is SpanElement then we append the terminator at the end of SpanElement
2) If the last leafElement is not SpanElement we append a SpanElement and add the terminator there.
So, in your linkElement, if the last leafElement is not a Span, a new span with terminator is appended.
We've discussed your specific case with our experts. Let's see if there will be a better solution. Thanks
The following may be a better work around. Hopefully it will be helpful:
// set up textflow
var w:int = 300;
var h:int = 200;
var tf:TextFlow = new TextFlow();
tf.interactionManager = new EditManager();
var container:Sprite = new Sprite();
var controller:ContainerController = new ContainerController(container, w, h);
addChild(container);
tf.flowComposer.addController(controller);
// add an image - using a sprite as the source
var s:Sprite = new Sprite();
s.graphics.beginFill(0xFF0000);
s.graphics.drawRect(0,0,w,20); // make it the full width
var d:DivElement = new DivElement();
var p:ParagraphElement = new ParagraphElement();
var ige:InlineGraphicElement = new InlineGraphicElement();
ige.source = s;
ige.float = Float.LEFT;
ige.lineHeight = 0; // only when float is NOT Float.NONE;
p.addChild(ige);
d.addChild(p);
tf.addChild(d);
// force terminator creation (it's not guaranteed to be there until normalize) and set the lineHeight to zero
tf.tlf_internal::normalize();
// use getLastLeaf to get the FlowLeafElement containing the Terminator - note this is always a SpanElement
var terminator:FlowLeafElement = p.getLastLeaf();
// if the length is great than one than the last leaf has actual text besides the terminator and you may not want the lineHeight to go to zero
if (terminator.textLength == 1)
terminator.lineHeight = 0;
tf.flowComposer.updateAllControllers();
// add some text below
var d2:DivElement = new DivElement();
var p2:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
span.text = "some text aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
//span.lineHeight = 0;
p2.addChild(span);
d2.addChild(p2);
tf.addChild(d2);
tf.flowComposer.updateAllControllers();