PDA

View Full Version : Recognizing instance name=variable string


tfinamore
12-16-2000, 04:57 PM
In my _root I have two variables

menuName (set to "EMPTY")

and

menuPosition (set to false)

I have five buttons that will change the menuName variable with a string to correlate with a movie clip instance name on the main stage.

I am having difficulty writing the script that will recognize if the instance name is the same as the menuName variable and if there is no menu already visible (menuPosition=false) then show the currently selected menu.

I know my buttons are working, on my main stage I have a dynamic text box that prints the menuName string and I see that they all work properly.

"show" and "hide" are frame labels that are within the same movie clip on the first frame of the instance clip, I have the following script:

//decide if to show the menu
if ((this._name == _root.menuName) and (_root.menuPosition == false)) {
gotoAndPlay ("show");
_root.menuPosition = true;
}


after it becomes visible I have the following script:

//decide if to hide the menu
if (_root.menuPosition == false) {
_root.menuName = "EMPTY";
gotoAndPlay ("hide");
}
if (this._name != _root.menuName) {
gotoAndPlay ("hide");
_root.menuPosition = false;
}

Can anyone tell me why this is not working? And how to make it work?

FlashGuru
12-20-2000, 07:22 PM
//decide if to show the menu
if ((_name == _root.menuName) and (!_root.menuPosition)) {
gotoAndPlay ("show");
_root.menuPosition = true;
}


after it becomes visible I have the following script:

//decide if to hide the menu
if (!_root.menuPosition) {
_root.menuName = "EMPTY";
gotoAndPlay ("hide");
}
if (_name != _root.menuName) {
gotoAndPlay ("hide");
_root.menuPosition = false;
}

if that doesnt work let me know!