1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Update: a newer version available here

Well, I discovered some annoying bugs, all fixed in this version ..
As per my previous post here, I still recommend embedding fonts to avoid improper rendering.

ActionSctipt 2.0 version available here
ActionSctipt 3.0 version available here

Requirements:

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

Recommended Properties:

  1. embedFonts: for proper rendering on Mac/Linux.

Properties:

  1. data: for referencing original input string, use the data property (utils.data) instead of (TextField.text) where “utils” is an instance of StringUtils class.
  2. wrapFactor: optional reduction value (Mac only) for wrapping correction when using bi-directional text, possible values: .98 or less.
  3. htmlLines: array of spliced text block HTML lines.
  4. numLines: integer value of total text block lines.

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

Features Not Supported:

  1. Arabic Diacritics (not necessarily for reading Arabic language in general, arabs are using diacritics mostly for writing Quran, and in that case diacritics are not the only missing feature, there’re many other ligatures cases in Arabic used for Quran writing).

Change List:

  1. Proper rendering for HTML bullet list (include the bullet character “•” in the Character Embedding menu).
  2. Optimized conditions for basic thorough loop.
  3. New properties for referencing text block lines (htmlLines, numLines).

Fixed Bugs:

  1. Multi-level HTML tags, for example:
      <a href="#"><font>text</font></a>
  2. Line-break determination on Mac.

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

Test files are available here using ASUnit Framework

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

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

Requirements:

  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

Properties:

  1. For matching/comparing input string, when referencing original input string use the data property (utils.data) 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

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Update: a newer version available here

As per my previous post here, I’ve followed the same approach, but this time using ActionScript 3.0 to produce my method for proper Arabic rendering in a dynamic TextField.

You can find this one here.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

I had my older AIR 1.1 application which uses encrypted local store data for saving specific settings per user, today when the AIR runtime gets updated to version 1.5 my application turned to a total mess!
I’m using various classes in my simple application that might cause this issue as far as I thought, like loading CSS on runtime or loading conditional states and components depending on certain parameters retrieved at login ..
I spent a few hours hunting down what actually happened and at last I think I figured it out ..
The new AIR has 3 new features, encrypted local databases, Flash Player 10 capabilities and the new WebKit update, it seems that Adobe somehow has made a change regarding to how the AIR runtime read and write the encrypted local data, and a simple try and catch block of code just revealed the problem ..

The following example assumes that there is encrypted data stored using an older version of the application complied using AIR 1.1, and the application checks for a certain key for loading the perspective CSS file, since the new runtime may not able to read the older version of the encrypted data then it should throw an error, at this point I reset any previous saved data and load a default CSS file in order to bypass this issue when any client update to AIR 1.5

var skinBytes:ByteArray;
var styleEvent:IEventDispatcher;
try {
	skinBytes =  EncryptedLocalStore.getItem("skin");
	if (skinBytes != null) {
		styleEvent= StyleManager.loadStyleDeclarations("css/"+skinBytes.readUTFBytes(skinBytes.length)+".swf");
	} else {
		styleEvent = StyleManager.loadStyleDeclarations("css/black.swf");
	}
} catch(e:Error) {
	//Alert.show(e.message);
	EncryptedLocalStore.reset();
	styleEvent = StyleManager.loadStyleDeclarations("css/black.swf");
}

Well, this is not an intelligent solution at all, cause these saved data my be much more complicated and I should not force my user to have it all wiped out just for upgrading the runtime!
Anyway, I’m not sure if my conclusion about the encryption handling change between AIR 1.1 and 1.5, especially that Adobe didn’t mention anything regarding to this particular issue as fas as I know, but I thought that may be this help someone else experiencing the same problem when migrating his application to the new AIR runtime.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)

I was working on a weekly events module ..
At some point I need to be able to get a list of week days by providing only on day, for example if I provide today date I expect the whole week contains today regardless to the current month or years ..

The following example shows how we can do that, with some extra features ..


source code available via flash context menu