0

アンチエイリアス タイプ「デバイス フォントを使用」の動的テキスト フィールドがあります。テキスト フィールドを回転するとテキストが消え、テキスト フィールドが 360 度回転すると再表示されます。

4

1 に答える 1

0

Flash Player 10 以降、プロパティDisplayObjects'を調整することで回転できrotationZます。でこれを行うこともできます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);
            }
        }
    }
}
于 2012-08-14T15:06:51.880 に答える