Hi all, I’m having trouble figuring out what is wrong with my ActionScript. The script is set to open and close screens when a button is clicked, for the code below it works perfectly when opening or closing screen1 and closes screen2 while opening screen1 but it will not close screen3 while opening screen1. Obviously I am new to this and still learning so any assistance is greatly appreciated. Thanks in advance.
function toggleContent(event:MouseEvent) {
if (togglescreen.currentFrame == 1) {
if (togglescreen2.currentFrame != 1) { // if screen2 is open
togglescreen2.gotoAndPlay(10); // closes screen2
{
if (togglescreen3.currentFrame != 1) { // if screen3 is open
togglescreen3.gotoAndPlay(10); }// close screen3
}
}
togglescreen.gotoAndPlay(2); // open screen1
} else {
togglescreen.gotoAndPlay(10); // close screen1
}
}
toggle_btn.addEventListener(MouseEvent.CLICK, toggleContent);