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?
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.Posted at July 25, 2003 04:37 PM | Further reading