I want to make a toggle switch with the key.isDown function. I want the user to be able to press the key and toggle the visibility on and off for a movie clip.
So, if user clicks 'h' (keycode 72) or 'H' (keycode 104) they will turn on visibility for the movie clip "helpmenu".
If the user presses it again it'll turn off for 'helpmenu'. The Key.isDown function must be used in this case as Keypress only supports one key command. And Key.isDown only works in a if statement, as far as I know. So I'm royally confused.
The coding below doesn't work but I'm trying to fudge with it so it does.
=============================
onClipEvent (enterFrame) {
if (Key.isDown (72, 104)) {
if (_root.menu_up == false) {
setProperty (helpmenu, _visible, true);
_root.menu_up = true;
}
} else if (_root.menu_up == true) {
setProperty (helpmenu, _visible, false);
_root.menu_up = false;
}
}
=============================
I asked a similar question in regard to keyPress last week sometime, and oldnewbie provided the answer which I incorporated above. Unfortunately I can't translate it to Key.isDown terms. If anyone can help me out, thanks in advance!
-Cardy
So, if user clicks 'h' (keycode 72) or 'H' (keycode 104) they will turn on visibility for the movie clip "helpmenu".
If the user presses it again it'll turn off for 'helpmenu'. The Key.isDown function must be used in this case as Keypress only supports one key command. And Key.isDown only works in a if statement, as far as I know. So I'm royally confused.
The coding below doesn't work but I'm trying to fudge with it so it does.
=============================
onClipEvent (enterFrame) {
if (Key.isDown (72, 104)) {
if (_root.menu_up == false) {
setProperty (helpmenu, _visible, true);
_root.menu_up = true;
}
} else if (_root.menu_up == true) {
setProperty (helpmenu, _visible, false);
_root.menu_up = false;
}
}
=============================
I asked a similar question in regard to keyPress last week sometime, and oldnewbie provided the answer which I incorporated above. Unfortunately I can't translate it to Key.isDown terms. If anyone can help me out, thanks in advance!
-Cardy