Skip to main content
Participating Frequently
August 12, 2010
Question

links to internal functions

  • August 12, 2010
  • 1 reply
  • 581 views

The following tutorial works fine for static html that is hard coded into the tag

http://www.xllusion.net/ed/2010/04/26/flex-4-richeditabletexttlf-link-example/comment-page-1/#comment-2057

but I need my text to be bindable and dynamic loading sometime later...I cannot seem to get the event things work if I embed like in the aforementioned tutorial so im sure my code for the adding events is good.

Im using the following

<s:RichEditableText paddingLeft="10"
                                        paddingBottom="5"
                                        paddingRight="10"
                                        id="articleField"
                                        maxHeight="300"
                                        textFlow="{TextConverter.importToFlow( articleText, TextConverter.TEXT_FIELD_HTML_FORMAT )}"
                                        editable="false" />

many thanks

This topic has been closed for replies.

1 reply

djNomadAuthor
Participating Frequently
August 12, 2010

I do think its a latency issue, when the text is available im doing the following with more success but my inline image isnt showing

articleField.textFlow = TextFlowUtil.importFromString(brandz[currentBrand].summary);
                articleField.textFlow.addEventListener("myLinkEvent", onTextLink);
                articleField.textFlow.addEventListener('inlineLinkEvent',inlineLinkEvent);
                articleField.textFlow.addEventListener(CompositionCompleteEvent.COMPOSITION_COMPLETE,fini);

Adobe Employee
August 16, 2010

Images that are referenced by url may not be loaded when the textFlow is initially generated. The TextFlow will send an event when the load is complete --- see the StatusChangeEvent. I would try this, after you've got a textFlow object:

newFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE,recomposeOnLoadComplete,false,0,true);

private function recomposeOnLoadComplete(e:StatusChangeEvent):void

{

     if (e.status == InlineGraphicElementStatus.ERROR)

          trace("IOERROR loading inlinegraphicelement",e.errorEvent.toString());

     if (e.element.getTextFlow() == activeFlow && e.status == InlineGraphicElementStatus.SIZE_PENDING)

     {

          activeFlow.flowComposer.updateAllControllers();

     }

}

The TextFlow will send a SIZE_PENDING when the graphic is loaded, and this code will force an update when that happens. For better performance, make a counter of all the inline graphic elements that are pending, and do the update once after they've all completed, and remove the event listener. But this code should work fine for you, and if you leave the event listener in place will handle any susequent graphic loads on that text flow as well.

- robin

djNomadAuthor
Participating Frequently
August 16, 2010

Thanks for this helpful answer alas I could not get it to fire the event and what is activeFlow reffering to here ? I have commented out that part of the handler but the handler isnt even being run.