Oops, sorry, forgot the types & setup for a couple of those elements:
protected var _fteContainer:Sprite;
protected var _textBlock:TextBlock;
function setupRTL() {
_fteContainer = new Sprite();
//addChild(_fteContainer);
//We create a 2nd text field that will deal with our
RTL text...
var elementFormat:ElementFormat = new ElementFormat();
elementFormat.fontSize = Number(fmt.size);
var desc:FontDescription = new FontDescription("Arial");
elementFormat.color = uint(fmt.color);
elementFormat.fontDescription = desc;
var textElement:TextElement = new TextElement("Hello",
elementFormat);
_textBlock = new TextBlock(textElement);
_textBlock.bidiLevel = 1;
var textLine:TextLine = _textBlock.createTextLine(null,
_text.width, 0);
_fteContainer.addChild(textLine);
}
On 28/05/2010 10:50, Glen Pike wrote:
Arabic - you can use "Flaraby" which works really well - that takes
your arabic text and "flips" the order of words / characters correctly.
It does not work for other BIDI languages - we had to upgrade to CS4.
There is another solution
http://www.red-id.com/blog/post/BIDI-Flash-support-3.aspx but we found
it to be buggy and cheaper to upgrade to CS4 and use the Text Layout
Framework:
Here is some code for using the TLF to add in text - it will create a
multiple lines of text in a restricted width container until the text
is fitted..
if (true == _useRTLText) {
trace("useRTLText - _fteContainer.numChildren
" + _fteContainer.numChildren);
while (_fteContainer.numChildren) {
_fteContainer.removeChildAt(0);
}
TextElement(_textBlock.content).text = value;
var textLine:TextLine;
var prevLine:TextLine;
for (;;)
{
textLine =
_textBlock.createTextLine(prevLine, _text.width);
if (!textLine) {
trace("finished adding text lines -
total " + _fteContainer.numChildren);
break;
}
textLine.blendMode = BlendMode.LAYER;
trace("aligning text " + textAlign + "
width is " + textLine.width + " / " + _text.width);
if ("center" == textAlign || "center" ==
fmt.align) {
textLine.x = _text.x + (_text.width -
textLine.width) / 2;
} else if("right" == textAlign) {
textLine.x = _text.x + (_text.width -
textLine.width);
} else {
textLine.x = _text.x;
}
textLine.y = prevLine ? prevLine.y +
textLine.height : _text.y + fmt.size;
_fteContainer.addChild(textLine);
trace("added a text line " +
_fteContainer.numChildren + " at x,y " + textLine.x + ", " + textLine.y);
prevLine = textLine;
}
addChild(_fteContainer);
}
On 28/05/2010 10:36, allandt bik-elliott (thefieldcomic.com) wrote:
hi guys
can anyone give me any pointers as to how to support right to left
text like
arabic in a as3 fp9 site i've done please?
my xml is all utf-8 if that makes a difference?
thanks guys
a
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders