UPDATE: problem greatly solved since Firefox 3.5, we now have to add an exception for our workaround for version 3.5+ !
You probably heard of the wmode bug, about broken text input when you use wmode="transparent" or wmode="opaque". Terrible bug! It's been around for years and it's a bloody shame that it hasn't been resolved yet. Numerous posts can be found about this bug and many people have tried to find a suitable workaround. I am no exception. My mission was to make textinputs work acceptably on a full Flex website with wmode capabilities, because we had to use an overlaying iframe (like this for example).
Let's illustrate the problem first. Directly below, you have a wmode="opaque" embedded SWF with 2 textinputs. Now, open a Firefox browser and simply try to type an "@" in the first textinput. If you're on a Belgian AZERTY keyboard like me, I bet you see an "é" and no "@". Pretty hard to type in an e-mailaddress if you can't find the "@", don't you think? And unfortunately, the @ isn't the only problem...
The second textinput does things already a little bit better, thanks to a little (but nasty) hack. I simply re-map bad character input with what it should be by extending the TextInput class. A fully effective remapping is impossible because on different keyboard layouts and on different platforms (mac, pc) I clearly witnessed that there are inconsistencies. This means that 1 key-for-key remapping isn't enough: you'd need one for every type of keyboard (oh, and there are many!). Sadly, I couldn't figure out how to detect a user's keyboard layout. As soon as I discovered that, I gave up... Anyway, here's the source code of my attempt to hack some sense into the TextInput control (see WmodeTextInput class). And by the way, there's the same issue for all other types of text input controls in Flex and Flash, so...
The only 100% effective workaround would be to capture keyboard input with JavaScript and forward that to the SWF. Check out JSTextReader. Unfortunately, this solution isn't working on that many browsers...
P.S. don't hesitate to vote for this bug on http://bugs.adobe.com/jira/browse/FP-479 (and for the other wmode-related bug reports too :-p).


5 Comments
It took me an half day to find this bug! Means for my client £300. Thanks u Adobe! The only solution I found for the moment is to use a virtual keyboard on my Flex app. Fortunately, my client loves it!
Please note that this bug appears to be a Mozilla bug and not a problem with the Flash plugin itself. Adobe is cheering from the sideline to encourage Mozilla developers to fix it.
Hi Hans,
Thanks for the great work.
I have used your mapping in my workaround. Adding now French keyboard support.
Feel free to create new keyboards support if you want.
http://nicolas.cynober.fr/blog/116,flex-workaround-for-wmode-bug.html
Best,
Nicolas
hi,
the problem seems to have been addressed in Firefox 3.5
not completely though : the first special character I type is still wrong, but the others are matched ok.
damn.
Thanks for sharing. The slogan on the one waffle is killing me.
One Trackback
[...] to Hans Van de Velde, for the Beligan Keyboard [...]