宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应
您当前的位置: > 博客2 > AS2与AS3技术

[AS3]as3文本的竖排写法示例

2016-10-13 00:16:48 点击量:11 标签: 收藏本文

[AS3]as3文本的竖排写法示例

  1. var _textFiled:TextField = new TextField(); 
  2.             _textFiled.text = "横排or竖排"
  3.             _textFiled.wordWrap = true
  4.             _textFiled.selectable = false
  5.             _textFiled.antiAliasType = AntiAliasType.ADVANCED; 
  6.                         addChild(_textFiled); 

 

  1. _textFiled_textFiled.text = _textFiled.text.split("").join("\n"); 

 

  1. var fontDescription:FontDescription=new FontDescription("宋体"); 
  2.             var format:ElementFormat = new ElementFormat(); 
  3.             format.fontSize = 32
  4.             format.color = 0xfffff
  5.             format.textRotation = TextRotation.AUTO; 
  6.             format.fontDescription=fontDescription; 
  7.             var textElement:TextElement=new TextElement("",format); 
  8.             var textBlock:TextBlock = new TextBlock(); 
  9.             textBlock.content=textElement
  10.             textBlock.lineRotation=TextRotation.ROTATE_90; 
  11.             var linePosition:Number=0
  12.             var previousLine:TextLine=null
  13.             while (true) { 
  14.                 var textLine:TextLine = textBlock.createTextLine( 
  15.                     previousLine,  
  16.                     180); 
  17.                 if (textLine==null) { 
  18.                     break; 
  19.                 } 
  20.                 textLine.y=20
  21.                 textLine.x=linePosition
  22.                 linePosition-=25
  23.                 addChild(textLine); 
  24.                 previousLine=textLine
  25.             }; 

 

  1. _textFiled_textFiled.text = _textFiled.text.split("\r").join(""); 

 

ABOUT US
宜昌农人网络科技有限公司

我们是一家提供综合软件外包与弱电工程服务的技术公司。

业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。

公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室