文本框竖排问题

1.

var str:String="WELCOME TO XIAMEN";                  //这里改成你从XML里读进来的信息
var myfd:FontDescription=new FontDescription("宋体");
var myformat:ElementFormat=new ElementFormat(myfd,36,0xff0000,1,"rotate270");
myformat.trackingLeft=10;
myformat.trackingRight=10;
var mytx:TextElement=new TextElement(str,myformat);
var myblock:TextBlock=new TextBlock();
myblock.content=mytx;
myblock.lineRotation="rotate90";
var mytxline:TextLine=myblock.createTextLine();
mytxline.x=500;
mytxline.y=100;
addChild(mytxline);

 

2.

var myText:TextField = new TextField();
myText.autoSize = "center";
myText.text = "想咋排就咋排横排竖排随便排".split("").join("/n");
addChild(myText);

 

竖排后的文字再恢复成横排
myText.text = myText.text.split("/r").join("");

 

3.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml " layout="absolute">
 <mx:Text x="408" y="315" text="Text" width="97" height="142" textAlign="center" id="testxxx" paddingTop="20"/>
 <mx:VBox x="123" y="165" height="97" width="192" id="aaaa" borderColor="0x999999" backgroundColor="0xff0000">
  <mx:Label text="Label" width="191" height="96" textAlign="center" paddingTop="{aaaa.height/2}"/>
 </mx:VBox>
 
</mx:Application>
虽然垂直居中默认不提供,不过通过paddingXXX控制的好还是可以做到的。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值