Please note that ExpatTech is close for the Christmas and New Year holidays. We will re-open on 2nd January 2024.

ExpatTech Techblog

Peter Todd 2009.04.07. 14:46

Flash Cookbook - Appendix - wmode Bug in Flash Player - Solution 1.

There seems to be a bug in Firfeox and IE with flash player. If you embed swf and set wmode to transparent, the keyboard input breaks with international keyboards. Important to know that if you do not use transparent or opaque window mode this problem does not appear.

If you can't change this option and you need to use transparent mode there are some simple solutions for this.

First solution is to force your application - your users - to run Google Chrome. Those guys fixed this bug (or never existed in Chrome).

Obviously this solution is a bit violent so let's say your users shouldn't be forced. This case you can make a giant workaround for sure: define the tasks your flash needs to serve and write code to handle keyboard events as your app needs it.

For us the simplest way was this: you create a textbox in the html code, position it over your flash where the textbox should appear and use this box as input. Handle the event when the enter is pressed and send the correct text to flash. Inside flash there should be a code to accept calls from javascript: this is solvable by using ExternalInterface.

Let's see the code in AS3:

if (ExternalInterface.available)
{
    ExternalInterface.addCallback("sendToFlash", jsCalled);
}

function jsCalled(str:String) {/*runs when javascript called*/}

Place the condition somewhere in the beginning to tell flash to accept calls from javascript.

jsCalled function gets the text from javascript - it's correct with every keyboard! - and you should put your text wherever you want to.

javascript description comes soon, or you can simply google it: javascript flash interaction or the best is to look at:

http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/external/ExternalInterface.html