image issue
- September 9, 2009
- 1 reply
- 604 views
Hi there,
I have been having a play with the TLF and I am having issues with images that I am loading from within the content.
images load fine but if I have a base TextLayoutFormat with lineHeight set the image flows over the text.
ideally I would like the text to flow around the image but I haven't been able to work out how to do this.
any help would would be appreciated.
var flow:TextFlow;
var format:TextLayoutFormat = new TextLayoutFormat();
format.fontFamily = "fontArial";
format.fontSize = 18;
format.color = 0x434244;
format.kerning = Kerning.ON;
format.lineHeight =28.8;
format.renderingMode = RenderingMode.CFF;
format.fontLookup = FontLookup.EMBEDDED_CFF;
var config:Configuration = new Configuration();
config.textFlowInitialFormat = format;
firstContainer.x = 30;
firstContainer.y = 60;
main_Txt.addChild(firstContainer);
secondContainer.x = 30;
secondContainer.y = 110;
main_Txt.addChild(secondContainer);
var firstController:ContainerController = new ContainerController( firstContainer, 700, 30 );
var secondController:ContainerController = new ContainerController( secondContainer, 700, 600 );
secondController.columnCount = 2;
secondController.columnGap = 20;
secondController.verticalScrollPolicy = ScrollPolicy.ON;
flow = TextFilter.importToFlow(markup, TextFilter.TEXT_LAYOUT_FORMAT, config);
flow.leadingModel = LeadingModel.AUTO;
flow.flowComposer = new StandardFlowComposer();
flow.flowComposer.addController( firstController );
flow.flowComposer.addController( secondController );
flow.flowComposer.updateAllControllers();
flow.interactionManager = new SelectionManager();
flow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGED, picLoaded);
function picLoaded(event:StatusChangeEvent):void {
var image:InlineGraphicElement = event.element as InlineGraphicElement;
flow.flowComposer.updateAllControllers();
}
<main_text><TextFlow xmlns="http://ns.adobe.com/textLayout/2008" whiteSpaceCollapse="preserve"><format id="contentheading" color="0xAC864D" fontWeight="bold" fontSize ="34" />
<span format="contentheading">Intro to Andrew</span>
<p>His direction to winemaking has been a slightly unusual one. With no family history in the wine industry, the road started with an interest in gardening as little fella, and headed towards viticulture and winemaking as my love of wine grew. <img style="margin: 0px; vertical-align: top;" alt="andrew" source="http://internaladdress/images/stories/article/andrew.jpg" height="320" width="320" /></p>
