July 25, 2003
Hebrew MX Tools

I'm still in the process of making a Hebrew version of one of our client's sites. As I cannot wait for the next version of Flash to hopefully solve all my right-to-left problems I've written some workaround tools for myself.

Tool number one is an addition to the TextField object that will reformat a bidirectional text so it can be read correctly. The task is to check in each line how many words do fit in and then make a manual linefeed. Unfortunately i have to use the not very precise getTextExtent() method. But from what I can see with my non-existing knowledge in Hebrew this works for texts that are not nested too deep.

Tool number two plugs into inputfields and tries to make them handle Hebrew input. This means taking control of the cursor and setting it to the left or right of a letter, depending on its origin. It will not do the fancy cursor acrobatics that you see in native HTML input fields, but it should be able to handle standard things like names, adresses or one-liners. It also tries to handle text that gets pasted in via the clipboard. This is harder than it looks because you have to find out first which part of the text has changed. Then you have to apply the flipping algorithm to this part, because internally the system stores any text in logical order. At least that's what Windows XP does. This is where you can help me and check if pasting works correctly with your OS. There are some cases where the routine will fail: if you select a part of the text and replace it with some shorter text it will do strange things. What also fails is copying a Hebrew text from this input field into another application. As flash doesn't have access to the clipboard I cannot re-flip the text after it has been copied.

Here you can test the input field. If you don't have Hebrew support in your system, you will not see any special effects - why are you reading until here anyway?
TYPE="application/x-shockwave-flash" LUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
In case you experience any no-nos or bugs - send me a mail or use the comments - perhaps it can be fixed.

I would call this a beta, but if you want to experiment with it yourself or expand it to a version that also handles arabic chars here is the download link: Flash Hebrew Tools 1.0 But don't ask me to explain to you how it works. And don't expect it to work at all.

Should this script against my better knowledge make you so happy that you feel bad to take it for free I can offer you two ways to relieve yourself: there is my Amazon wishlist and there is PayPal.

Posted at July 25, 2003 04:37 PM | Further reading

Hi Mario,

Kudos for the job you are doing. This is pretty much the world we're living in on a daily basis for the past four years or so. A rare bunch of friends of mine have also been working on trying to solve the defect like yourself, but the problem in most cases is that it's never 100% and won't pass. I really appreciate what your doing.

As for a quick bug report:
1. The backsapce doesn't work.
2. When I insert an english word, the first letter in the sentence gets cut off.
3. If you type a number in Hebrew and want to have an english word after it, the word will appear before the number.
4. Quotation marks don't seem to work.

I'm not sure if it's related but since viewing this page my Pentium4 is almost completely stuck. Are you running some CPU intetensive procedures in there or it just me?:)

Anyway, if you need someone to test it now and then you have my email and I'll be glad to help in any way I can. Just let me know.



Posted by: Amir Dotan on July 25, 2003 05:04 PM

Thanks for the check Amir. Looks like I'll have to work on it further. For this number problem - perhaps you can add a line in the comments which behaves wrong.

The speed thing sounds strange. Does this happen with long texts or all the time? There is nothing going on except the listener for "onChanged".

Posted by: Mario Klingemann on July 25, 2003 05:12 PM

Not quite sure what you meant by "perhaps you can add a line in the comments which behaves wrong". If you meant an example then if I want to have:
english 90210 Hebrew
(typing from right to left of course)
Then the result will be:
90210 english Hebrew
The moment you start typing the english word following the number it starts before the number. The backsapce isn't working only with the Hebrew text but seems to be working with English text.

The punctuation seems to work well so far. As for the CPU problem I'm not sure. After spending more than 5 minutes in his page and running some tests in the text field everythign starts moving really slow and it takes about a second before can see the text I'm typiing now. I have nothing else running other than Outlook and te usuall stuff.

The first letter in the sentence sems to get cut off the minute I switch to type in English :/

Posted by: Amir Dotan on July 25, 2003 05:36 PM

Now I know what you mean. Oops - I thought that's the way it is done. I guess that can be corrected. I will study the behavior of the HTML input field again.

Posted by: Mario Klingemann on July 25, 2003 05:46 PM

The thing is there isn't really one way of writing it. It depends on the context of what you are writing. If I write to someone in Hebrew "I bought Flash 6" than the number will appear after the English word. However, I can also say something like: "Make sure you ring Macromedia up and buy 13 Flash MX and 10 Dreamweaver MX". In which case I'll have to put the number before the English word.

At the moment, once you have an English word you can't seem to get a number after it, meaning to its left. It will always appear to its right, no matter what language you use. After seeing other made-up solution to the RTL defects in Flash I can honestly tell you Mario that they never offer a 100% correct experience and act a bit different. I believe that the avarage user's patience threshold is much lower than that of any fellow developer who might test it. Once it starts behaving a bit different than what user expect they won't bother with it and will just walk away.

I don't mean to be negative, but after seeing others non-Hebrew speaking flash developers and Israeli developers as well trying to offer a workable solution and can't make it work 100% I at least came to conclusion that the solution lies elsewhere. Developers should work with a tool, not try and figure out how to fix it.

Posted by: Amir Dotan on July 25, 2003 06:08 PM

For some reason, on my Mac (osx 10.2.6, running Safari as the browser), your text box won't even let me switch to Hebrewto type aynthing, althugh I am able to type Hebrew in other places.

Since the full flash MX on mac won't let you switch to Hebrew (althugh Hebrew is part of the system), it is probably due to a Macromedia bug and not to anything you did.

btw, if i switch to Hebrew and then go to the text box, the keyborad goes back to English. not very helpful...

Posted by: Xslf on July 26, 2003 07:00 PM

It didn't work for me at all.
I'm running XP, with English and Hebrew as the available languages.

It wouldn't type for me in Hebrew mode.

In MOzilla, the following code was on the screen:
TYPE="application/x-shockwave-flash" LUGINSPAGE="http://www.macromedia.com/go/getflashplaye
But I tested it in IE also, and no dice.

Posted by: Larry Yudelson on July 27, 2003 04:42 AM

Hi Mario.
In addition to what was mentioned:
Hebrew number Hebrew - gets messed up,
Hebrew English Puncuation - also...
Hebrew number Puncuation - also...

Keep up the good work, remember what FLEM did to the MX event model...

cheers, Elor.

Posted by: Elor Ilan on July 27, 2003 10:15 AM

Mario: trying to send you an e-mail (mario@coma2.com) but it's consistently being returned to me. Is there somewhere else I can try?

Posted by: KJW on July 27, 2003 11:58 AM

Hi Mario
Cheers for your work. I have tried this approach way back in the 98 era and it worked ok for a while, but if you want to use some html tags or English and hebrew at the same line you are in trouble.

I have attacked this issue a little differently. I decided to drop the embeded fonts and stick to Unicode system fonts, as I found that when I use unicode and external files, the letters are fliped correctly in hebrew and most of the warp done is reasonable (as long as there are no periods or commas at the end of a warpped line). I used align to right and it works reasonably

To solve the commas and the periods issue I have added a small routine that searches for these characters and a space (" .") and adds unicode directional characters (String.fromCharCode(0x200F)) before and after the space. I don't know how I came to this funcky idea, but it seems to work fine with window XP,2000, win98 hebrew enabled.

I still have problems with win98 hebrew. For some odd reason, In some cases the texts are still flipped. Any ideas?

Also, the align right is not completly aligned - an annoying macromedia bug

Note: its the first time I publish this knowledge and I did not document it properly yet. Do you know of anybody else trying my approach.

Posted by: ramster on September 16, 2003 11:07 PM

Works flipping brilliant for me - I'm using XP Home.

Regarding the following postings:

1. The backsapce doesn't work.
===Use the Del key instead

2. When I insert an english word, the first letter in the sentence gets cut off.
===Works perfectly for me on XP Home.

4. Quotation marks don't seem to work.
==No problem here either.

Hope this helps,


Posted by: Jezza on May 3, 2004 02:37 PM

Dear Sir/s,

Actually I have got a problem to get the right program to able me to read the Arabic texts through the website in general. I will be grateful if you could help me with this. My computer is iMac OSX, version: 10.2.6

Thank you,

A. Samarah

Posted by: A. Samara on May 9, 2004 08:48 PM

I would love to get ahold of the fla that created the swf that is on the site. I am having problems with the exact makeup of the input field's properties to make my swf look exactly like yours does.


Posted by: Nate Thelen on June 3, 2004 08:44 PM

I like what u did very much ... i am trying to do the same thing using SwishMax ... everything works .. but i cant type from right to left in an input text ...
thats my only problem ..... when i try it, it types the word upside down ...
in your text area it doesnt happend ... but you cant use the backspace ... all you can do to delete something is the mark it with the mouse and then to delete it .....
Is there anyway i can use it in SwishMax ...

Posted by: Eshel on July 4, 2004 03:32 AM

sites like ynet.co.il that use flash make linux crash.
If I don't install falsh player, it doesn't.
tried several browsers, and linux distros
can anyone help?

Posted by: michael on August 30, 2004 07:37 AM

I just installed flash 8. I was sure they would solve the RTL direction problem in this version but for some reason they do not want to solve this and enable us Hebew and Arabic users to use flash for our web sitees

Posted by: avi on September 20, 2005 04:26 PM

Almost all good! But the problem for me is that I'm using Yiddish, which contains vowels under alef, etc...
And if you test it, you'll see that the vowel is written on the right of the consonant, not under it. By the way, it works with simple input or dynamic text fields of Flash MX, but the problem is with the English letters and punctuations marks mixed together with Yiddish and also with text selection. What a pain!

Posted by: Serge on January 23, 2006 03:42 AM
Post a comment

Email Address:



Remember info?

Thank you!

Most Visited Entries
Sketches, Works & Source Code
In Love with
Powered by
Movable Type 2.661

© Copyright Mario Klingemann

Syndicate this site:
RSS 1.0 - RSS 2.0

Quasimondo @ flickr
Quasimondo @ LinkedIn
Quasimondo @ Twitter
Quasimondo @ Facebook
Quasimondo @ MySpace
Quasimondo is a Bright
Citizen of the TRansnational Republic
My other blog in german

My family name is written Klingemann,
not Klingelmann, Klingeman, Klingaman, Kingemann,
Kindermann, Killingaman, Klingman, Klingmann, Klingonman
Klingemman, Cleangerman, Klingerman or Kleangerman

profile for Quasimondo at Stack Overflow, Q&A for professional and enthusiast programmers