# Pass an expetion to a function that calls other functions

**URL:** <https://forum.kirupa.com/t/pass-an-expetion-to-a-function-that-calls-other-functions/321956>\
**Category:** Uncategorized\
**Created:** [May 5, 2011, 3:06pm UTC](https://forum.kirupa.com/t/pass-an-expetion-to-a-function-that-calls-other-functions/321956 "2011-05-05T15:06:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonassus](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bonassus](https://forum.kirupa.com/u/bonassus)\
**Post date:** [May 5, 2011, 3:06pm UTC](https://forum.kirupa.com/t/pass-an-expetion-to-a-function-that-calls-other-functions/321956/1 "2011-05-05T15:06:40Z")

</div>

I don’t know if this is possible with Actionscript 3. What I want to do is have a closeAll(); function that calls other function that in turn close sections of an application. I would be easier to have all the close functions in the closeAll() function and then pass a reference to the once that i don’t want to be called.  
something like this.

```auto
function closeAll(don'tCallThisFunction){
var _don'tCallThisFunction = Don'tCallThisFunction;
function disable( _don'tCallThisFunction){
//???stop close2 from being called.
}
close1();
close2();
close3();
close4();
close5();
}
closeAll(close2)

```

this code is obviously a long way from working but i’m not sure how to get started with this problem. any advice would be appreciated.  
Thanks.
