01.26.2010
As per my previous post here, I’ve made some improvements to my method for proper Arabic rendering in a dynamic TextField using ActionScript 2.0.
An ActionSctipt 3.0 version available here
Many thanks to all reviewers, your comments were very helpful bringing this version available, now you can use and test my new parseArabic method ..
Requirements:
- Dynamic TextField
- HTML Enabled TextField
- Pre-Defined TextFormat
- Arabic Fonts must include a complete Arabic Presentation Forms-B (glyphs from FE70 to FEFE according to the Unicode Standard 5.2)
Features Supported:
- Embedding Fonts (just put a dynamic textfield on-stage and select at least Basic Latin (95 glyphs) and Arabic (1088 glyphs) from the Character Embedding menu).
- Arabic Ligatures.
- Word Wrapping.
- Bi-Directional text.
- HTML Text.
- Loading External text.
Features Not Supported:
- Arabic Diacritics.
Fixed Bugs:
- Correct Arabic Ligatures with/without embedding fonts
- Correct Brackets Directions
- Clean Line-Breaks
Here is an example works with this external XML file:
download the above example here
Note:
When you try to select and copy the above text into a static TextField it will display Arabic properly as well, just another benefit of this method, but if you paste the copied text into any other text editor you will see an alien version instead!

(6 votes, average: 4.33 out of 5)
100 100 ya 3am el 7ag allah yenawar
xVisage
thanks a bunch
Asim Kh
Hi, Thanks for such a nice post. If i have to change arabic font then how can do it.
xVisage
In order to use custom fonts, basically you need to embed those fonts first, then you define the font name for the TextFormat parameter, for example:
good work.
xVisage
thank you
Man I LOVE YOU!!
You’re the best … now I can load arabic text from a database.
Cheers
xVisage
Sure, all you need to do is to connect and read your Arabic text from MySql and send it back to Flash, for example:
PHP (getArabic.php):
ActionScript 2.0:
Any time
Thanks so much for this post your really brilliant.
by the way I noticed a bug with the number ٤ and ٦ when I write them in arabic in the xml and when I replaced them with 4 & 6 it’s worked I’m just telling you because u did a great job and you should know if there is any bug.
Thanks again
i am not into flash at all, so i am very sorry that i didn’t understand what is this all about.
can you tell me, in layman term, if this is some workaround to get flash objects render Arabic sanely, i mean a patch users do once that affects every object executed, or it is a library for flash developers to include in their projects so that it will be able to display Arabic scripts correctly ?
if the former, can you explain for dumb user, in details, what to do ?
many thanks in advance
xVisage
@Khaled
Well, it’s not a patch that affects every object, also not quite a library for flash ..
Basically it’s a String Parsing method (custom AS based function), which analyze and re-order Arabic glyphs in a proper manner with correct rendering on windows, mac and linux, furthermore, it supports custom fonts ..
Regular TextField in Flash does not understands right-to-left languages, so it can not map custom fonts, no word wrapping and even breaks the string on mac machines ..
I did not hack into Flash or use third-party techniques to solve this, all I did is simply instruct Flash to render Arabic language manually using ActionScript by finding and replacing Arabic characters with its correct forms from unicode charts, my method has nothing to do with any special features added to ActionScript (since version 1.0) or to Flash Player (since version 5), it’s just a workaround ..
I left my solution absolutely free and open for anyone who can understand my approach and build similar methods for other right-to-left languages, even update my own for better usage ..
I hope I’ve helped understanding what this is all about
xVisage
@Rabah
I think it’s a Font issue, I use unicode charts for Arabic Presentation Forms-B (glyphs from FE70 to FEFE according to the Unicode Standard 5.2), may be this is your issue, can you try one of these fonts and tell me if you still have the same bug? (those fonts has full representation Form-B)
Thank you for your compliment