Hi,
I am just trying to create a simple escape the room game. I have a main frame with all the objects and another layer with different views. What I want to accomplish is, e.g.
If a panel with buttons is clicked you go to the next frame, which shows a zoomed in panel with buttons. Then you enter a code and if it is correct you go back to the main frame. As the code was correct a drawer, which was previously closed opens and a new item is added to your inventory.
This is my code for the room with the drawer:
drawer3_mc.enabled = false;
drawer3_mc.addEventListener (MouseEvent.CLICK, foundObjectScrewd);
function foundObjectScrewd(event:MouseEvent):void{
if (drawer3_mc.enabled == true) {
screwd_btn.visible = true;
blue1_mc.visible = false;
text1.text = " You have found a screwdriver!";
}
else
{
text1.text = " The drawer won't open...";
}
}
This is my code for the actual zoomed panel:
stop();
go.addEventListener(MouseEvent.CLICK,checkpassword);
go.buttonMode = true;
function checkpassword(event:MouseEvent){
userinput = code.text;
if (userinput == thepassword) {
gotoAndStop("main");
text1.text = "You hear a click somewhere in the room.";
drawer3_mc.enabled = true;
}else {
instruction.text = "You input the wrong password!";
}
}
After I input the correct password in the panel I move back to the main room, but I keep get the message " The drawer won’t open… ". How can I get Flash to remember that the password has been right?