# Function reference?

**URL:** <https://forum.kirupa.com/t/function-reference/214188>\
**Category:** flash\
**Created:** [January 26, 2007, 4:46am UTC](https://forum.kirupa.com/t/function-reference/214188 "2007-01-26T04:46:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![horizens](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/horizens/32/2714_2.png) [@horizens](https://forum.kirupa.com/u/horizens)\
**Post date:** [January 26, 2007, 4:46am UTC](https://forum.kirupa.com/t/function-reference/214188/1 "2007-01-26T04:46:57Z")

</div>

I’m building an app with transitions out of each page. I’m using the code below to store references to a function and parameters for that function to use. Is this the best approach though?

```
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]private[/COLOR] [COLOR=#000000] **var** [/COLOR] __root:[COLOR=#0000FF]MovieClip[/COLOR];

```

[COLOR=#0000FF]private[/COLOR] [COLOR=#000000] **var** [/COLOR] \_\_clip:[COLOR=#0000FF]String[/COLOR];  
[COLOR=#0000FF]private[/COLOR] [COLOR=#000000] **var** [/COLOR] \_\_func:[COLOR=#000000] **Function** [/COLOR];  
[COLOR=#0000FF]private[/COLOR] [COLOR=#000000] **var** [/COLOR] \_\_section:[COLOR=#0000FF]String[/COLOR];  
[COLOR=#0000FF]private[/COLOR] [COLOR=#000000] **var** [/COLOR] \_\_id:[COLOR=#0000FF]Number[/COLOR];  
[COLOR=#0000FF]private[/COLOR] [COLOR=#000000] **var** [/COLOR] \_\_moduleID:[COLOR=#0000FF]Number[/COLOR];

menu\_mc.[COLOR=#000080]photo\_btn[/COLOR].[COLOR=#0000FF]onPress[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
\_this.\_\_clip = [COLOR=#FF0000]“contentBGnoMask”[/COLOR];  
\_this.\_\_func = \_this.[COLOR=#000080]getPhotoGallery[/COLOR];  
\_this.\_\_section = [COLOR=#FF0000]“theatrical\_artist”[/COLOR];  
\_this.\_\_id = [COLOR=#000080]0[/COLOR];  
\_this.\_\_moduleID = [COLOR=#000080]30[/COLOR];  
\_\_root.[COLOR=#000080]contentBG\_mc[/COLOR].[COLOR=#0000FF]gotoAndPlay[/COLOR]COLOR=#000000[/COLOR];

```
            [COLOR=#808080]*// this is the call normally: getPhotoGallery('theatrical_artist', 0, 30);*[/COLOR]
        [COLOR=#000000]}[/COLOR];

```

[COLOR=#000000] **function** [/COLOR] currFunctionCOLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
\_\_root.[COLOR=#0000FF]attachMovie[/COLOR][COLOR=#000000]([/COLOR]\_\_clip, [COLOR=#FF0000]“contentBG\_mc”[/COLOR], [COLOR=#000080]999[/COLOR], [COLOR=#000000]{[/COLOR][COLOR=#0000FF]\_x[/COLOR]:[COLOR=#000080]453[/COLOR], [COLOR=#0000FF]\_y[/COLOR]:[COLOR=#000080]151[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR]\_\_func == getPhotoGallery[COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
\_\_func[COLOR=#000000]([/COLOR]\_\_section, \_\_id, \_\_moduleID[COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR] [COLOR=#0000FF]else[/COLOR]  
[COLOR=#000000]{[/COLOR]  
\_\_func[COLOR=#000000]([/COLOR]\_\_section, \_\_id[COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]

In the movieclips that contain the transitions out, on the last frame I have this:

```
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]stop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];

```

[COLOR=#0000FF]\_parent[/COLOR].[COLOR=#000080]cms[/COLOR].[COLOR=#000080]currFunction[/COLOR]COLOR=#000000[/COLOR];  
[/LEFT]  
[/FONT]

So, basically, the photo\_btn is writing the references and variables, telling the transition to play, when it reaches the end, it calls the function that’s stored in the \_\_func ref and uses the parameters. I’m doing it this way because I have a bunch of nav buttons that all call different functions, and this is the only way I could figure out to get transitions to play and then call the desired function at the end.

Does this make sense? Or is there another option with listeners maybe?

Thanks!
