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!