You can create a custom loader, and set a callback function to it, when the loader load complete, the callback will be executed. Here is a simple example
public class MyLoader extends Loader
{
public function MyLoader($callBack:Function = null)
{
super();
callBack = $callBack;
this.contentLoaderInfo.addEventListener(Event.COMPLETE, Complete);
}
private var callBack:Function;
private var _url:String;
public function set url(value:String):void {
if (_url != value) {
_url = value;
var request:URLRequest = new URLRequest(_url);
this.load(request);
}
}
protected function Complete(event:Event):void {
var target:Object = event.target;
if (callBack) {
callBack.apply(null, [target]);
}
}
And you can use it like this in class A
public function class A {
public function test():void {
var loader:MyLoader = new MyLoader(setData);
loader.url = "assets/pig.jpg";//you asset url
}
private function setData(obj:Object):void {
//the obj type is LoadInfo
}
}