Advanced Arabic support workaround for Flash.
Posted By wassim in FlashHello everyone,
I have been working for some time now on the development of the Quran Searcher and Reciter as you may have noticed; basically it’s an online application that allows you to search for the occurrences of a particular word in the holy Quran and to recite Quran verses or chapters.
The Quran Searcher and Reciter is a Flash 8/ActionScript 2 based application with powerful features and a very beautiful user interface.
What I would like to share with you are some of the steps and bottlenecks we had to go through in order to reach the functionality we were looking for.
- The first problem we had to deal with was that Flash lacks real support of RTF (right to left) based languages like Arabic; this had an enormous impact on and was a big setback in our work.
An example of the consequences of this lack of support is that Flash wraps Arabic sentences in a character-based manner instead of the correct word-based fashion i.e it breaks in the middle of a word and wraps the reminder of this word to the next sentence instead of taking the whole word to the next line. This was a major problem as it could change the meaning of the verse!
Facing this harsh reality, we only had one way out: coding our own multiline Arabic text wrapper.
- The second major problem was the lack of direct database connectivity, Flash cannot directly connect to and retrieve data from a database, it needs to communicate via XML and PHP with the concerned mySQL database, this was fine for us till we faced the fact that in order to allow php to send the data via XML to Flash we have to change our default php encoding which means large unpredictable mess in the other php related sides of our host. We simply had to abandon this approach and to find a way to emulate database queries in pure ActionScript.
Having that done was the biggest and most important achievement in the development of this application.
What we basically came up with is a multidimensional array storing all of our elements, this had a positive side too since flash implements zlib compression to the data embedded in the swf file which reduced the size of data we needed to be loaded and consequently the loading time of the application.
- The third problem was searching Arabic text for a particular string; the problem really jumps in when the Arabic text stored in the database-like structure of our Flash application has diacritics (tashkeel) while the search string is diacritics-free. This was also a major issue and we had to come up with a somewhat hard solution: There has to be two fields for each verse, one with and one without diacritics. The search proceeds in the diacritics-free field and returns the ID of those verses containing the search word, then the with-diacritics field having the same ID would be retrieved and displayed.
Well, I don’t want to add more line to this article as I know you tend to get bored of looong readings, I will add more in a separate post later on.
Till then, enjoy this piece of art: The holy Quran Searcher and Reciter.


January 2nd, 2007 at 1:26 pm
Salam,
I would like to ask if there is a way I could use your Arabic multiline text wrapper.
Thanks,
Mohamed
January 2nd, 2007 at 4:53 pm
Hello, it’s not available for free if that’s what you are asking about, I am sure we can work something out though if you just want the compiled class not the source file.
April 5th, 2008 at 6:18 am
Great Job Wasssim, I would definitely like to get this work used on a new portal i am doing, how can we do such thing?
April 5th, 2008 at 9:02 am
Hi Tareq,
What exactly is what you would like to use?? The application itself i.e. the Holy Quran Searcher and Reciter or the arabic text wrapping algorithm?
April 9th, 2008 at 2:57 am
just the arabic text wrapping algorithm
February 5th, 2009 at 4:26 pm
Hello Wassim,
Great work done. Can u share the compiled class for the use. I m developing an application for education sector in UAE. but facing the same issue. If you can share the class for the wrapper it will be very helpful for me.
Thanks in advance.
February 5th, 2009 at 4:35 pm
With the release of the new textLayout component for flash CS4, this class is now obsolete, please visit adobe labs and download the beta version of the component.
February 6th, 2009 at 4:58 am
Thanks for the quick reply.
A small request to you, if possible can forward me the link to download this component ? Meantime I am searching for it.
February 6th, 2009 at 5:42 am
Hello Wassim,
I have downloaded the component from the site. I have also gone through there documentation. But I couldn’t recognize how to install and use this component in flash.
Can you please help me to come out of this situatuion.
Thanks.
August 26th, 2009 at 1:22 pm
Hello
I am intereted about your work. I want to know what is the cost to give me the clases for the search and arabic text wrapping algorithm form your application.
Tnx for your time.
August 27th, 2009 at 9:09 pm
The new textLayout component for flash CS4 has all this and more, please visit adobe labs and download the beta version of the component.
August 31st, 2009 at 10:37 pm
I want to use this for a as2 project and the text layout is for as3 project