Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : Keypress captures


kglad
3/4/2004 7:20:43 PM
using spacebar is no problem, but using f1 is a problem because it's an ie
explorer default button for help. so if you're movie is being viewed in an ie
window, you'll have an extra problem to overcome. here's code to toggle
visibility using the down arrow and spacebar:

myListener = new Object();
myListener.onKeyDown = function() {
if (Key.isDown(Key.SPACE)) {
if (mc1._visible) {
mc1._visible = 0;
} else {
mc1._visible = 1;
}
} else if (Key.isDown(Key.DOWN)) {
if (mc2._visible) {
mc2._visible = 0;
} else {
mc2._visible = 1;
}
}
};
Key.addListener(myListener);
Parag Shah
3/4/2004 11:31:36 PM
Hi All,

I have 2 mcs. I want the visibility of both of them to toggle upon pressing
F1 and Spacebar respectively. How do I do that?

Regards,

Parag Shah


JudyAnne
3/5/2004 10:23:21 PM
Thank you, I have been trying to get Esc to work and found that is the same for Stop on IE.

Is there a way to set the focus to the Stage so that it will override the Browser buttons?

kglad
3/6/2004 3:55:14 PM
izzzy12k
3/10/2004 7:41:03 PM
javascript:document.FlashAppletIDHere.focus();

will place the focus on the applet.. as for the button reassignment I do not know what you need there.

AddThis Social Bookmark Button