Hi,
I am trying to create a generic MovieClipLoader listener that I can use in a variety of situations. Within my class that creates the MCL, I have the following code. The second block of code is what I have in my generic Listener class.
private function loadImage():Void {
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.addListener(new LoadListener(this.initImage));
mcl.loadClip(imagePath, __clip.placeholder_mc);
}
private funtion initImage(img:MovieClip):Void {
img._width = 50;
}
class LoadListener {
private var __loadComplete:Function;
public function LoadListener(loadComplete:Function) {
__loadComplete = loadComplete;
}
public function onLoadInit(mc:MovieClip):Void {
__loadComplete(mc);
}
}
I have trimmed it all down for this example, but basically what I want to happen is for the Listener object to call the given function of the initial calling object. I tried seeing if the Delegate class could help, but didn’t get any further.
thanks,
Marcus.