flash on 2011-9-22
♥0 |
Line 33 |
Modified 2011-09-22 13:31:48 |
MIT License
archived:2017-03-20 03:03:19
ActionScript3 source code
/**
* Copyright fujiopera ( http://wonderfl.net/user/fujiopera )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/uUpX
*/
package {
import flash.display.Sprite;
import flash.text.engine.TextBlock;
import flash.text.engine.TextElement;
import flash.text.engine.TextLine;
import flash.text.engine.ElementFormat;
import flash.text.engine.FontDescription;
public class TextBlock_bidiLevelExample extends Sprite {
public function TextBlock_bidiLevelExample():void {
var fontSize:Number = 36;
var format:ElementFormat = new ElementFormat();
format.fontDescription = new FontDescription("Adobe Hebrew");
format.fontSize = fontSize;
var y:Number = 0;
var leading:Number = fontSize * 0.2;
var text:String = "abc" + String.fromCharCode(0x05D0, 0x05D1, 0x05D2);
var textBlock:TextBlock = new TextBlock();
textBlock.content = new TextElement(text, format);
// bidiLevel even
textBlock.bidiLevel = 0;
var textLine = textBlock.createTextLine(null, 400);
y += leading + textLine.ascent;
textLine.y = y;
y += textLine.descent;
addChild(textLine);
// bidiLevel odd
textBlock.content = new TextElement(text, format);
textBlock.bidiLevel = 1;
textLine = textBlock.createTextLine(null, 400);
y += leading + textLine.ascent;
textLine.y = y;
addChild(textLine);
}
}
}