Home arrow Blog arrow Firefox Flash ignoring keys, keypresses
Firefox Flash ignoring keys, keypresses Print E-mail
Saturday, 07 October 2006
So it seemed. The Firefox Flash plug-in isn't really ignoring keypresses, it is the Key.isDown() function that is always returning false. We found out that this is one of the symtoms of the dreaded Firefox wmode bug. We had a hard time finding that out, although many people have written about this bug.
It seems that a lot of bloggers put the solution in their title and not the problem. Googling for "flash firefox wmode key bug" will return lots of relevant articles, queries such as "flash firefox key bug" and alike hardly return anything relevant.

A little more about the wmode bug. It only happens in Firefox on Windows, when you set the wmode parameter in the embed tag in your HTML. A number of things happen when setting this wmode parameter:

  • The function Key.isDown() always returns false.
    If you're using the Key.isDown() function in an onKeyDown handler, just use the Key.getCode() function. Key.getCode() works fine, and it is made for use in onKeyDown handlers. But I noticed that some people (who are colleagues of mine)  use the Key.isDown() function in an onKeyDown handler.
    If you really need the Key.isDown() function, to test if a key is still down in  a loop or between frames, you must use a workaround. Something like this will do:
    var spaceDown:Boolean = false;
    this.onKeyDown = function() {
    if (Key.getCode(Key.SPACE)) spaceDown = true;
    }
    this.onKeyUp = function() {
    if (Key.getCode(Key.SPACE)) spaceDown = false;
    }
    this.onEnterFrame = function() {
    if (spaceDown) {
    // whatever you want to do when the SPACE key is pressed
    trace ("SPACE");
    }
    }
    Key.addListener(this);
    This issue and solution is also posted here.
  • When entering text in a textfield the wrong keymapping is used (for some keys) instead of the user's keymapping. This bug will often show up when entering an email address. The @ key will put something else in the text field. In my case a é character , but British users seem to get a double quote, Germans get a q, French users get something else, etc
    As far as I know there is no workaround for this.
While searching I came across other issues. I'm just listing them, I didn't test them myself:
Mike Lyda reported another key related bug. This one has nothing to do with the wmode parameter and it only shows on Windows. The shift key is ignored on non-english keyboards. Read more on Mike's site.

Comments
this bug seems to be related with the embed vmode=transparent parameters... try remove it and your keys restart work fine...
  Posted by Mars Spider, Whose homepage is http://www.marsspider.net on Monday, 09 October 2006 at 9:22

This bug also appears on the Mac. I have trouble with Games and HTML with the keyboard not working. After I quit Firefox and restart it, some of the problem is alleviated. However, the 'spacebar' to move down an HTML page is weird, popping to the bottom, sometimes working, sometimes not. I'm running Mac OS X 10.4.8 and Firefox 2.0.
  Posted by Monica, on Friday, 24 November 2006 at 5:23

2 previous comment. Man. Dont forget that wmode=opaque is way better cuz it's not slow down frames per second.
  Posted by Arseniy, Whose homepage is http://gamebalance.com on Thursday, 15 March 2007 at 9:03

There are several tickets on the FireFox bugzilla site. The most active seems to be: https://bugzilla.mozilla.org/show_bug.cgi?id=312920

I signed up for an account and 'voted' for this bug, maybe that will expedite a fix?

  Posted by Ben Scarola, Whose homepage is www.site9.com on Wednesday, 18 April 2007 at 8:19

Though I have read the above article, but can't solve my problam anyway. May be somebody knows when I'll be able to read more about that?
  Posted by Adam Lee k2007, Whose homepage is http://www.mobilclub.org/ on Wednesday, 09 May 2007 at 12:00

I did notice the problem with my version of Firefox on my Mac, but then again I'm lucky if I can ever get Firefox to start on my Mac. I have never had a problem with Firefox on Windows; interestingly enough, it seems that that is where most other people are having their trouble. I don't know what to say other than that I must be the luckiest programmer out there to never have had a problem. Perhaps they haven't gotten around to fixing it yet because not everyone is experiencing the problem with such brevity as you are. When did you first start having the problem? With what edition of Firefox did you first notice that wmode was causing a problem for you? It may be that you really do just need to restart Firefox once in a while and go from there. Maybe close it out and let it restore your sessions so you don't have to start all over from the beginning but at least give it somewhat of a fresh start.
  Posted by linen, Whose homepage is http://www.factoryfast.com.au on Wednesday, 05 September 2007 at 6:24

I was adding a flash banner to our system one time. I was then using FF but it was strange that the wmode=transparent does not play well with Firefox. It breaks textfields. The flashing cursor is hidden and after some time it was impossible for me to write in the textfield. The worst thing was, the keyboard mappings were completely screwy and all non-standard characters become broken. So, is this an effect of this bug you’re telling us here?
  Posted by oil portraits, Whose homepage is http://www.portraitkingdom.com on Saturday, 27 October 2007 at 1:49

Yes it is.
  Posted by Johan van Mol, on Saturday, 27 October 2007 at 5:42

I too find firefox quite buggy in some areas but with all the add ons giving so much more funtionality, I love it and would not use anything else.
  Posted by john, Whose homepage is http://www.lingeriediva.co.uk on Tuesday, 04 March 2008 at 4:27

I've been trying to solve this issue for ages, good work hope there is a cure sometime soon
  Posted by dave, Whose homepage is http://www.lingeriediva.co.uk on Friday, 21 March 2008 at 6:52

many thanks for sharing this usefully article. And thanks for share the great Information on snook´s site, too.

Greetings Michael Ziebach

  Posted by Michael Ziebach, Whose homepage is http://www.medienstern.de/webdesign/ on Saturday, 29 March 2008 at 5:12

This bug has been fix with the latest issue. I was using an old version off FF. I was not planning on upgrading as I thought it doesn't support an addon that I use everyday. The addon seems to be ourdated, I tried installing the new version and I was happy it worked!
  Posted by Kent, Whose homepage is http://www.martialartspride.com/ on Friday, 11 July 2008 at 10:43


 1 
Page 1 of 1 ( 12 comments )
©2005 MosCom

Add your comments to this article Firefox Flash ignoring keys, keypre... ...

Name (required)

E-Mail (required)
Your email will not be displayed on the site - only to our administrator
Homepage

Comment