Skip to main content
Inspiring
December 14, 2009
Question

How to receive INLINE_GRAPHIC_STATUS_CHANGE only once on text flow changes

  • December 14, 2009
  • 1 reply
  • 452 views

Hello,

I have a scenario in which I need to replace some images in a text flow with substitutes and then later I need to "restore" the text flow and show the original images. I update the text flow by adding/removing FlowElements. After the point when I "restore" the text flow I receive INLINE_GRAPHIC_STATUS_CHANGE events for all the images that were restored. This is rather a problem for me because when I "restore" I would like immediately to calculate the new dimensions of the text flow (or rather its containers).

Is there a way to achieve such "restore" so I get the proper dimensions (iamge sizes) immediately?

I do not want to receive the notifications asynchronously later because my effects depend on the exact image sizes.

As mentioned I tried with adding/removing FlowElements. I also tried working with TextScrap i.e. cut a TextScrap before adding the substitutes and then paste the same TextScrap when "restoring". This didn't help neither. It again reloads the images from scratch and doesn't reuse the initially loaded image data.

One workaround could be to create two sets of containers with two text flows where the only difference is the images put in the text however this may lead to too big memory consumption and/or performance problems and I would like to avoid it if possible.

Any ideas are very appreciated!

This topic has been closed for replies.

1 reply

Adobe Employee
December 15, 2009

Graphics on the clipboard don't get loaded.

You could load all the graphics in your code and when they are all satisfactorily loaded set the DisplayObjects directly to the appropriate InlineGraphicElement's source property.

Hope that helps,

Richard