[as 2.0] using f1 to show help in a flash movie


I want to create a shortcut with the key ‘f1’. If pressed the movieobject ‘uitleg’ visible property will be true, the movie object is actually nothing but some text which explains what to do. When pressing f1 again the visible property will go false again and you can continue with the game.

I hoped the following code would work, but nothing happens at all. If i remove the && (uitleg._visible = false) it does work, but I wouldn’t know how else to set the property back to false when pressing the f1 key again.

uitleg._visible = false;

keyListener = new Object();
keyListener.onKeyDown = function() {
    if ((Key.getCode() == 112) && (uitleg._visible = false)){     
        uitleg._visible = true;
        } else if ((Key.getCode() == 112) && (uitleg._visible = true)) { 
        uitleg._visible = false;

Should be uitleg._visible == false in the if-class i think… also at the else if double “=”

I think one “=” is the same as not equal…? am I right…?

ah! didn’t know you had to use double “=” in an if statement. thx for the help! it’s solved and I can resume my school project. :slight_smile:

You don’t have to, but you can’t use a single =.

You either do:

if ((Key.getCode() == 112) && (!uitleg._visible)){


if ((Key.getCode() == 112) && (uitleg._visible==false)){