kerry, thx and yeah what zeh said :) zeh, thx :)
francis, thx alot thats exactly the problem i am talking about. the solution you found is something i actually considered before as a last resort, but the only way (i know about) to get the typed text into a textfield, is to let it have stage focus. which is bad since my custom textfield does something unique and cannot be based on the internal flash textfield display object (like i noticed the fl.controls.TextField ui component does). i also implemented a custom focus manager and all this means i would have to do some major architecture changes just to support some work around that gives me the info of which foreign key was pressed (i would have to keep a hidden textfield on stage and let it have stage focus etc etc something really ugly). do you know of any other way ? i noticed there is something called IME for japanese / korian etc languages. does it mean i can get which japanese char was typed but not which russian / hebrew / french / spanish one ? i mean, obviously the flash player knows which foreign char is typed since its displaying it in its textfield display object (when it has focus). i think i understand the benefit of having something like the charCode property that gives always the english char code (can be validated with regex etc), but its crazy not to provide the "real" char code somewhere. something must be wrong. someone please tell me i am missing something. wow i am so disappointed. until this issue as3 always positively surprised me in how cleverly it was crafted (well actually except overriding the internal focus management which was just lacking in documentation, but turned out completely do-able). .. ok oops sorry for ranting, a bit disappointed. thats all :) On Dec 14, 2007 8:01 PM, Francis Cheng <[EMAIL PROTECTED]> wrote: > As far as I know, you can't use the KeyboardEvent class for this purpose > because KeyboardEvent.charCode is designed to return the same value no > matter which language you use for input. What you need to do is actually > capture the value input into your text field and use String.charCodeAt() > on that value. Here's a blog post I came across with a working example and > the source code behind it: > > > http://blog.flexexamples.com/2007/07/21/finding-out-a-characters-unicode-character-code/ > > It's a flex example, but the core ActionScript code would be pretty much > the same in Flash. Just use charCodeAt() on the value you grab from your > custom textfield. When I switch my input mode to Russian for the sample swf > on that page, I get charcode 1092 for russian key "ф" and charcode 97 for > English key "a". > > HTH, > > Francis Cheng | Sr. Technical Writer | Adobe Systems Incorporated > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto: > [EMAIL PROTECTED] On Behalf Of Dani Bacon > Sent: Wednesday, December 12, 2007 12:02 PM > To: Flash Coders List > Subject: Re: [Flashcoders] as3 + non english input charCode ? > > kerry hi, and thx > > i think i didnt explain myself well. > i am using arial and i am successful in typing into a textfield, but thats > not what i am trying to do. > i am trying to listen to the keyboardevent keyDown and know which > character > was typed (in langauge other than english). > for example set up an empty FLA with the following code > > stage.addEventListener( KeyboardEvent.KEY_DOWN, test ); > > function test( evt:KeyboardEvent ):void > { > trace( String.fromCharCode( evt.charCode )); > } > > if i have a russian keyboard layout and i type the russian key "ф" ( "a" > key > in english layout ) the prev code still traces "a". > i need somehow to know what russian (or other language) char was typed. > basically i built my own custom textfield that has some special > functionality and it captures the keyboard etc and i am trying to get it > to > work also with other languages, but it seems the keyboardevent doesnt let > me > know which foreign language char was typed. > > anyone ? ideas ? > > On Dec 12, 2007 8:08 PM, Kerry Thompson <[EMAIL PROTECTED]> wrote: > > > Dani Bacon wrote: > > > > > KeyboardEvent.charCode, as stated in the as3 docs, returns the english > > > keyboard layout char code that was pressed... > > > that is even when i switch my keyboard to a russian layout, i keep > > getting > > > the charCodes as if it was still set to english. > > > so, how do i get the russian char that was typed (or any other > language) > > ? > > > > You need to use a Unicode font. If you're on Windows, you probably have > > Arial Unicode MS. Embed the Cyrillic character set, and it should work. > > > > Cordially, > > > > Kerry Thompson > > > > > > > > _______________________________________________ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >
_______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders