dimanche 29 novembre 2015

Allow a button press by true or false variable AS3

I have been making an advent calendar in which when you press the button the door opens. I have created a variable to control which date you can open them on called 'AllowOpen' if it is the right date. I have also created a function to go to a frame when clicked.

var AllowOpen: Boolean = false;
if (Day == 1) {
    AllowOpen = true;
} else {
    AllowOpen = false;

button1.addEventListener(MouseEvent.MOUSE_DOWN, click);

function click(event:MouseEvent):void

I can't work out how I would tell the the program to only open the door if allow open is true. I have tried the 'if' statement but it doesn't seem to work. Thanks

Aucun commentaire:

Enregistrer un commentaire