Skip to main content
Known Participant
September 15, 2011
Question

SubParagraphGroupElement and paragraph terminators

  • September 15, 2011
  • 1 reply
  • 795 views

I remember there was an issue before FP 10.1 where an image that was wider than the composition area put the paragraph terminator on the next line even though you the image is the only thing in the paragraph.

That works great but now I have a business case to have an image inside of a SubParagraphGroupElement. When the image is larger than the composition area now it is putting the terminator on an extra line after the image.

I am very deep into this feature and there insn't any other way to architect it at this point.

Any suggestions on how to proceed? It looks like an FTE issue so it almost seems like the only way to fix it is to override the elements in the text block.

Thanks,

Joel Marks

This topic has been closed for replies.

1 reply

Participating Frequently
September 16, 2011

Hi

Your issue seems very like the following discussion thread: http://forums.adobe.com/message/3661415#3661415. Please feel free to tell us if it is not and paste your code scrap here.

I re-attached the workaround example for that thread so that you can easily pick up:

// 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 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaa";

//span.lineHeight = 0;

p2.addChild(span);

d2.addChild(p2);

tf.addChild(d2);

tf.flowComposer.updateAllControllers();

Hopefully, it will be helpful.