I have this function that builds menus, and I’m using a tweening class function to move the menu items around. The thing is that when calling the tween function I need the submenu building function to wait until the tween is finished otherwise things start freaking out.
It’s organized like this (pseudo code):
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000]**function**[/COLOR] tweenItem[COLOR=#000000]([/COLOR][COLOR=#0000FF]movieclip[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000][[/COLOR]tweens the item[COLOR=#000000]][/COLOR];
[COLOR=#0000FF]movieclip[/COLOR].[COLOR=#000080]onMotionFinished[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
buildSubmenu;
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]function[/COLOR] buildMenuCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
tweenItemCOLOR=#000000[/COLOR];
[COLOR=#000000]function[/COLOR] buildSubmenuCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
buildMenuCOLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
tweenItemCOLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR];
[/LEFT]
[/FONT]
The problem is that I need the first tweening to finish before I can build the submenu. I’ve tried using the onMotionFinished, but it doesn’t seem to want to call a function nestled into another function (in this case buildMenu()).
Does anyone have any ideas about how to do this?