Flex Image Source Event, How do I know when a new source is received?
2 answers
if you are working with flex: Set the render event to the image component:
<mx:Image id="theImage" render="yourFunction(event)"/>
In the script field:
private function yourFunction(evt:Event){
var theWidth= (evt.target as Image).width;
}
The render event is called when any displayable is dispatched when the display list is refreshed and rendered.
Flash (AS3.0):
//constructor function
public function CustomDisplayObject() {
theImage.addEventListener(Event.RENDER, renderHandler);
}
private function renderHandler(evt:Event):void {
var theWidth:int = evt.width;
}
(only tested in flex)
+2
a source to share
You have to add event listener event event.creationComplete to know when it was loaded. Or maybe event.progress . I would look at the inherited events in the Image control and see what works.
+1
a source to share