flash on 2012-8-21
♥0 |
Line 33 |
Modified 2012-08-21 22:41:35 |
MIT License
archived:2017-03-20 10:43:33
ActionScript3 source code
/**
* Copyright owenray ( http://wonderfl.net/user/owenray )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/wJXX
*/
package {
import flash.text.engine.TextLine;
import flash.text.engine.TextElement;
import flash.text.engine.TextBlock;
import flash.text.engine.FontDescription;
import flash.text.engine.ElementFormat;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
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: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);
}
}
}