Dynamic Drop Down Menu

I am creating a menu which consists of Top Buttons and Sub Buttons. When a Top Button is clicked all Top Buttons below slide down as the masked SubButtons slide down. If the same top button is clicked again it should close meaning the Sub Buttons Slide up above the mask and dissappear and the other Top Buttons slide back up to their orignal location. If a Top Button has been clicked and is open and another Top Button is clicked the open button should close and the Top Buttons should go to their original position then the Clicked Top Button should open.

Now that I’ve explained what I’m trying to do, I’m wondering if anyone would be willing to try and help me figure out what is wrong with the script I have so far. My script is not complete and the only script I have done so far is the script to create all the buttons, label them, and move the top level buttons when they are clicked.

I am having some problems, sometimes the script works correctly sometimes it doesn’t. I am including the .fla incase anyone wants to help.

Thanks

edit: the scripting should all be on the actions frame on the main timeline or the Top Button inside the BtnGroup MC.

found one problem, under TopUpDown()


				if(this._y == this.OrigPos){
					_root.OpenCheck = _root.TargetButton;
					_root.TopDownComplete = 0;
					_root.TopDown();
				} else {
					this._y -=5;
					_root.TopDownComplete = 1;
				}

should be changed to

				if(this._y == this.OrigPos){
					_root.OpenCheck = _root.TargetButton;
					_root.TopDown();
				} else {
					this._y -=5;
					_root.TopDownComplete = 1;
				}

Just wondering if anyone found anything wrong, the problem only seems to be with the last 2 choices when something else is open.

just wondering if it’s the possibility that I have the script trying to execute multiple functions at once onEnterFrame, is there a way to tell it to unload the function once I don’t need it anymore?