# Passing function references

**URL:** <https://forum.kirupa.com/t/passing-function-references/190848>\
**Category:** flash\
**Created:** [June 15, 2006, 2:51am UTC](https://forum.kirupa.com/t/passing-function-references/190848 "2006-06-15T02:51:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcusjw](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@marcusjw](https://forum.kirupa.com/u/marcusjw)\
**Post date:** [June 15, 2006, 2:51am UTC](https://forum.kirupa.com/t/passing-function-references/190848/1 "2006-06-15T02:51:08Z")

</div>

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.

```auto

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;
}

```

```auto

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.
