首页 > 设计 > 详细

flash文本竖排效果实现as3代码

时间:2016-01-23 09:30:50      阅读:194      评论:0      收藏:0      [点我收藏+]

复制代码
代码如下:

import flash.text.engine.TextBlock;
import flash.text.engine.ElementFormat;
import flash.text.engine.ContentElement;
import flash.text.engine.TextElement;
var linePosition:Number = this.stage.stageWidth - 45;
var tb:TextBlock=new TextBlock();
var shijingText:String="葛之覃兮,施于中谷,维叶萋萋。黄鸟于飞,集于灌木,其鸣喈喈。葛之覃兮,施于中谷,维叶莫莫。是刈是濩,为絺为绤,服之无斁。言告师氏,言告言归。薄污我私,薄浣我衣。害浣害否,归宁父母。";
var format:ElementFormat = new ElementFormat();
format.fontSize = 12;
format.color = 0xCC0000;
format.textRotation = TextRotation.AUTO;
tb.lineRotation=TextRotation.ROTATE_90;
tb.baselineZero = TextBaseline.IDEOGRAPHIC_CENTER;
tb.content=new TextElement(shijingText,format);
var previousLine:TextLine = null;
while (true)
{
var textLine:TextLine = tb.createTextLine(previousLine, 180);
if (textLine == null)
break;
textLine.y = 20;
textLine.x = linePosition;
linePosition -= 25;
addChild(textLine);
previousLine = textLine;
}

flash文本竖排效果实现as3代码

原文:http://www.jb51.net/flash/actionscript/73522.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!