0
我有一个动态的文本字段与反别名类型“使用设备字体”。当我旋转文本时,文本消失并重新出现时文本字段已被旋转到360度。请告诉我的方式来实现这一点。提前致谢。在Flash中旋转文本cs5
我有一个动态的文本字段与反别名类型“使用设备字体”。当我旋转文本时,文本消失并重新出现时文本字段已被旋转到360度。请告诉我的方式来实现这一点。提前致谢。在Flash中旋转文本cs5
由于Flash Player 10可以通过调整它们的rotationZ
属性来旋转DisplayObjects'
。你也可以用你的TextField
来做到这一点。除此之外,您还可以使用TextBlock
类来解析TextLines
并相应地旋转它们。
欲了解更多信息,请查看我这篇文章:
http://www.yswfblog.com/blog/2009/05/21/the-knack-to-rotating-dynamic-text-in-flash-10/
下面是来自同一个博客帖子的代码:
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.engine.*;
public class TextTest extends Sprite
{
public function TextTest()
{
for (var i:int = 0; i <= 20; i++)
{
var txt:TextField = new TextField();
txt.selectable = false;
txt.width = 300;
txt.height = 100;
txt.text = "Hello world!";
txt.setTextFormat(new TextFormat("Georgia", 2 + 2*i));
txt.x = 6*(i*(i+1)/2);
txt.y = 30;
txt.rotationZ = 20;
addChild(txt);
}
for (var j:int=0; j<=20; j++)
{
trace(j);
var myString:String = "Hello world!";
var myFormat:ElementFormat = new ElementFormat();
var myFontDesc:FontDescription = new FontDescription("Georgia");
myFormat.fontSize = 2 + 2*j;
myFormat.fontDescription = myFontDesc;
var textElement:TextElement = new TextElement(myString, myFormat);
var textBlock:TextBlock = new TextBlock();
textBlock.content = textElement;
var myTextLine:TextLine = textBlock.createTextLine(null, 300);
myTextLine.x = 6*(j*(j+1)/2);
myTextLine.y = 150;
myTextLine.rotation = 20;
addChild(myTextLine);
}
}
}
}