Arabic text in as3

gabitzish picture gabitzish · Jan 10, 2011 · Viewed 7.5k times · Source

How can I display arabic text from right to left with as3?

Answer

Ellen S picture Ellen S · Jun 10, 2011

This code will do the trick:

import flash.text.AntiAliasType;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.external.*
import fl.text.TLFTextField;
import flash.text.TextFormat;

import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.elements.TextFlow;


var arabicTextField:TLFTextField = new TLFTextField();
arabicTextField.antiAliasType = AntiAliasType.ADVANCED;
arabicTextField.mouseEnabled = false;
arabicTextField.selectable = false;

arabicTextField.direction = flashx.textLayout.formats.Direction.RTL;

var fmt:TextFormat = new TextFormat();
fmt.color = 0xFFFFFF;
fmt.font = "arialArabic"
arabicTextField.embedFonts = false;
arabicTextField.defaultTextFormat = fmt;
arabicTextField.setTextFormat(fmt);