Reputation: 413
I'm using an SWFLoader that I declared like this:
<s:SWFLoader id="widget" maxWidth="150" maxHeight="75" maintainAspectRatio="true" />
And I also have a method to set its source from a ByteArray:
public function set widgetSource(widgetSource:ByteArray):void
{
this.widget.source = widgetSource;
}
It works fine but it seems like setting widget.source is done asynchronously and I need to know when it finishes loading the data...I tried several things without success, including adding a Event.COMPLETE listener to 'widget' but the event is never fired. Any ideas?
Upvotes: 1
Views: 576
Reputation: 684
You need to add the event listener to the loader itself, For example
var url:String = "yourlocation of file";
var myWidgetLoader:URLLoader = new URLLoader();
myWidgetLoader.addEventListener(Event.COMPLETE, completeHandler);
myWidgetLoader.load(new URLRequest(url));
function completeHandler(event:Event):void
{
trace(" fully loaded ");
}
Also you can add a progress event to check the progress of the loader, let us know how you go.
Upvotes: 1