Flash CS4 TextElement TextBlock FontDescription TextBlock TextLine

This code show how to use TextElement, TextBlock, FontDescription, TextBlock, TextLine

package druva{
import flash.display.Sprite;
import flash.text.engine.*;

public class TextTest extends Sprite {

public function TextTest() {

for (var j:int=0; j<=10; j++) {
var myString:String="Flashallys";
var myFormat:ElementFormat = new ElementFormat();

var myFontDesc:FontDescription=new FontDescription('Georgia','normal','italic','device');
myFormat.fontSize=2+2*j;
myFormat.fontDescription=myFontDesc;
myFormat.color = Math.random() * 0xFFFFEE;

var textElement:TextElement=new TextElement(myString, myFormat);
var textBlock:TextBlock = new TextBlock();
textBlock.content=textElement;

var myTextLine:TextLine=textBlock.createTextLine(null,300);

myTextLine.x = 30+(3*(j*(j+1)/2));
myTextLine.y = 150;

addChild(myTextLine);
myTextLine.addEventListener(Event.ENTER_FRAME, onLoop);
}

}
import flash.events.*;
private function onLoop(e:Event) {
e.currentTarget.rotationY += 3;
e.currentTarget.rotation = mouseX;
}
}
}

This movie requires Flash Player 9

Tags: , , , , , , , , , , , , ,

3 Responses to “Flash CS4 TextElement TextBlock FontDescription TextBlock TextLine on “Flash CS4 TextElement TextBlock FontDescription TextBlock TextLine”

Hi, Stranger! Leave Your Comment...

Name (required)
Email (required)
Website