Skip to main content

ActionScript 2.0 Arabic Parsing v1.3

Update: a newer version available here

This is a bit late, my apologies to you all, yet again, thanks to Jan Jonas and Yasmin (geekgirl)
I tried my best to solve bi-directional issues, it took me sometime to re-construct the wrapping part using completely different approach, it seems to be good when embedding fonts, but more wrapping issues pops-up for non-embedded fonts and only on Mac! this is weird, the whole solution was to solve Arabic ligatures when embedding Arabic fonts!
In addition, an overall code review has been taken care of, a lot of modifications in several places throughout the code has been done, if you like this one then you can start from hear instead, but if you don’t I think I need to know 😉
Anyways, this is exactly why I released my solution as open-source from the first place, what good of a solution without sharing it with others to contribute, may be you’ll have better luck than I did when you update this one yourself ..

ActionSctipt 2.0 version available here
ActionSctipt 3.0 version available here


  1. Dynamic TextField
  2. HTML Enabled TextField
  3. Pre-Assigned TextFormat
  4. Arabic Font

Features Supported:

  1. 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).
  2. Arabic Ligatures.
  3. Word Wrapping.
  4. Bi-Directional text.
  5. HTML Text.
  6. Loading External text on run-time.
  7. Windows/Mac/Linux support.
  8. Arabic enabled input fields using actionscript method (createArabicInput) with the help of javascript (arabicinput.js) beta


  1. For matching/comparing input string, when referencing original input string use the data property ( instead of (TextField.text) where “utils” is an instance of StringUtils class.

Features Not Supported:

  1. Arabic Diacritics.

Change List:

  1. New approach for wrapping text properly involving HTML tags, brackets, punctuation marks and bi-directional cases.
  2. Looping through input string thoroughly only once for better performance.
  3. Object class model structure with public properties and methods instead of static parser.

Fixed Bugs:

  1. Arabic character condition for letter (?).
  2. Beginning and ending text lines with non-Arabic characters (Embedding fonts required for Mac).
  3. Inline HTML tags (Embedding fonts required for Mac).
  4. Symmetrical swapping for bi-directional brackets.

Known Bugs:

  1. improper wrapping for non-embedded fonts only on Mac when begin text line with non-Arabic characters or when using custom format HTML tags.

Here is an example works with this external XML file (with run-time resizing vs. wrapping):

download the above example here

Well, still not perfect, for some reason I feel that a tiny code snippet can do all the magic to contain the mac issues with non-embedded fonts, just can’t find that one … yet!

Test files are available here using ASUnit Framework

3 thoughts to “ActionScript 2.0 Arabic Parsing v1.3”

  1. you are my hero
    god saves you
    and thank you sooooooo much
    i hope i hear from you soon
    or on mail.

Leave a Reply

Your email address will not be published. Required fields are marked *