Skip to main content
Inspiring
March 23, 2010
Question

InlineGraphicElement READY event

  • March 23, 2010
  • 2 replies
  • 2243 views

The READY event fires before the loaded has been scaled to the InlineGraphicElement's dimensions.

I see the content (a swf) briefly at its original size before it automatically gets sized to the correct dimensions.

I never receive a SIZE_PENDING event.

I would like to be ale to listen to the actual LoaderInfo and listen for the INIT event.

In the code for the InlineGraphicElement it just listens for COMPLETE: loaderInfo.addEventListener(Event.COMPLETE,loadCompleteHandler,false,0,true);

I think it should either expose the loaderInfo or rebroadcast the INIT event.

I have resorted to setting the InlineGraphicElemen.graphic.visible to false on READY and then adding an ENTERFRAME listener and switching it to visible after a frame - this is not a good or reliable solution.

If anyone has any ideas - I'd love to hear them - perhaps I am missing something?

This topic has been closed for replies.

2 replies

josh_onAuthor
Inspiring
March 24, 2010

I have been trying to get around this in various ways but have had no luck.  I want to document my attempts here because maybe they will shed light on my misunderstanding - or help others later,  or possibly reveal a bug.

I receive two events, "Loading" and "Ready"

I have an  InlineGraphicElement called ige.

My attempts at solutions:

Attempt 1

On 'Ready' set ige.graphic.visible to false, then set an EnterFrame listener to switch it back to true in one Frame.

Result: Image still flashes (intermittently) at full scale before resizing.

Conclusion: The scaling either happens before the Ready event or after the first enterframe. I am pretty sure it happens before the Ready event because I thought I saw it happen when the I left the visibilty at false.

Attempt 2

On "Loading" Event set ige.graphic.visible to false,

On Ready Event set an EnterFrame listener to switch it back to true in one Frame.

Result: Still flashes.

Conclusion: After looking at the InlineGraphicElement code I realized that it was also turning on and off the graphics visibility.

Attempt 3

On "Loading" Event set the ige.graphic.parent .visible to false

On "Ready" set an onEnterFrame to set the parent visibility back to true.

Result: still flashes.

Conclusion: it must be still unscaled after one frame after the "Ready" event.

Attempt 4

Try add my own listeners to trace when the "Init" event actually fires.

I couldn't set these listeners - I think because the ige.graphic is a Loader which is in a different ApplicationDomain.  I couldn't see how to set the ApplicationDomain to the current one. Any time I try to manipulate any property of ige.graphic.content I get runtime errors.  If I trace its value it says Object MainTimeline.

It may be that there is something problematic about the swfs  am loading - but they are pretty basic vectors. I will try and reprouce with something simpler.

This also may be a bug that is more prevalent on a slower cpu...

Adobe Employee
March 24, 2010

SIZE_PENDING is set when width or height are set to percentage values.  Is that not working?

Otherwise the graphic should automatically be scaled to size on load by TLF.  I haven't seen the flash at a larger size issue.   Do you have an example that demonstrates the problem?

Thanks,

Richard

josh_onAuthor
Inspiring
March 24, 2010

Hi Richard,

I never see the Size Pending event - but that sounds like it is because I am not using percentage values - I am using pixel values.

It does automatically resize every time but sometimes it is delayed and I see it large.

I will try and make a movie demonstrating this.