Tuesday 1 February 2011

Flex4, I can't get the size (width, height) of the Image component, when it is loaded

problem:
Flex4, I can't get the size (width, height) of a loaded pisture in Image component, when it is loaded from internet (and not only).

situation, what is really happening:
the event for complete download on the Image component is the "complete" event. This event is comming from the SWFLoader ! and because if that you might be can't get the width and the height of the loaded image; because it is not processed yet from the Image component.

solution:
the solution is simple, listen to "resize" event instead of "complete".
For professional handle you should listen both events.

read more about the Image's events (and not only)

No comments:

Post a Comment