# Function passed as parameter not working

**URL:** <https://forum.kirupa.com/t/function-passed-as-parameter-not-working/307822>\
**Category:** flash\
**Created:** [April 11, 2010, 11:58am UTC](https://forum.kirupa.com/t/function-passed-as-parameter-not-working/307822 "2010-04-11T11:58:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![d\_r\_i](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@d\_r\_i](https://forum.kirupa.com/u/d_r_i)\
**Post date:** [April 11, 2010, 11:58am UTC](https://forum.kirupa.com/t/function-passed-as-parameter-not-working/307822/1 "2010-04-11T11:58:55Z")

</div>

Hi,  
I’ve got this code:

```auto

function func2(options:Object)
{
     ...
}

function func1(onComplete:Function)
{
     func2({params:{param1:param1}, onComplete:onComplete});
}

func1(function(success:Boolean)
{
    if (success)
        trace("success");
});

```

Well, the func2 function has an event listener, and if I call the onComplete function from the event listener, it works fine:

```auto
loader.addEventListener(Event.COMPLETE, options.onComplete);

```

But I what I actually need in func2 is something like this:

```auto
loader.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(event:Event):void
{
  ...
  ...
  options.onComplete();
}

```

-which doesn’t seem to work. Please advise…
