Copy link to clipboard
Copied
Hi
I notice a interesting issue when I tried to print a RichEditableText with a textflow that have image.
If the control is already on the screen. Printing looks good.
If we tried to use a custom print view(the print view get a deepcopy of the textflow that's already showing), the image seems to be missing.
Further debugging show that the image status in the textflow is "loadpending" right before it print.
Is there anyway to force the textflow to load in the image before it starts printing?
Thanks for any idea
Copy link to clipboard
Copied
Not in all cases. Loading an Image from a source in FlashPlayer is by definition an asynchronous operation. Best way to do that is to copy the flow. compose it (first compose of a new image intiiates the load) and wait for all the images to load. It's fairly straightforward to count the images that need to be loaded in the TextFlow and then wait for them to load.
Hope that helps,
Richard
Copy link to clipboard
Copied
If that's the case. What will be the best way to count the number of images in a textflow or html text?
Is there any function like "document.images.length" to get the images count.
Basically I have a spark list with custom item renderer that have richeditabletext in each list item.
Each richeditabletext take some html text that can have multiple src images.
I like to print out the whole list.
Thanks for any idea.
Copy link to clipboard
Copied
For reference. I found a site showing how we can manually count the images in textflow using regex.
Not sure how accurate that is. but here is the link for reference. http://flashsimulations.com/2010/09/10/handling-image-loading-in-tlf-textflow-and-textfield/
Basically
var source_AttributeRegExp:RegExp = /source="[^"]+"/gi;
Since getting images count is a requirement for printing TLF.
If the above routine is correct, somebody should copy that code and put it in the TLF Class somewhere.
Thanks
Copy link to clipboard
Copied
It sounds good. You can also travel the textflow leaf by leaf(textflow.getFirstLeaf(); leaf.getNextLeaf();) to count InlineGraphicElement, which will be definitely accurate but may slow down your app.