Skip to main content
Venian
Inspiring
November 12, 2007
Question

onKeyDown(key.ENTER) works locally but not uploaded on a server

  • November 12, 2007
  • 5 replies
  • 322 views
Hi.

I have the following code:

this.passinput.onSetFocus = function() {
};

Key.removeListener(this.passinput);
this.passinput.onKeyDown = function() {
if (Key.isDown(Key.ENTER)) {
loadVariablesNum("first_login.php", 0, "POST");
_root.test_mc.gotoAndPlay(2);
}
};
Key.addListener(this.passinput);

The test_mc should go to the second frame where it is of another color. If i test it locally on my PC, it works but if I upload it to the web site and try then pressing enter no longer works.

Has anyone any idea of how to fix this?

Thank you.
This topic has been closed for replies.

5 replies

Venian
VenianAuthor
Inspiring
November 15, 2007
.
Inspiring
November 15, 2007
Like Helpy said, you need to have focus on the swf for the Keylistener to respond. It needs a single click with the mouse to get focus. That's not the same as the click to activate issue. It applies to all browsers, not just IE.

Try clicking it first. It seems that you can focus it with javascript in IE, but not other browsers:
http://www.actionscript.org/forums/archive/index.php3/t-120307.html
Venian
VenianAuthor
Inspiring
November 15, 2007
I don;t undestand. What's the problem? That security problem made by internet explorer "click to activate"? That is already javascripted. Still it doesn't work. I don't get it why it isn't working online, but only locally.
Inspiring
November 12, 2007
*also - the activeX stuff needs to be activated if you're not javascripting around it.
Inspiring
November 12, 2007
you need to have focus on that .swf (click it with the mouse) for the listener to pick up on it. I imagine thats the problem.