[RESOLVED] applying a text format retrieved using getTextFormat
Hi,
I'm working on a new project where I want to animate some text that makes up a whole word and I want to apply random values to each of these, so I do not have a very clear idea of how to do it so that each part of the word maintains the same format since it's going to be randomly generated.
I haven't found an example using getTextFormat that suits my needs when I want to apply the retrieved format on the next part.
Can that be done? And How? I have tried tracing out:
Code:
trace("Format "+= ind.getTextFormat());
but since it's not a property I get an error.
This is a general idea of what I mean to do:
Code:
var fontsArr:Array = ["Times", "Calibri", "Aparajita", "Tahoma", "Trebuchet MS", "Verdana"];
var select:Number = Math.round(Math.random()*fontsArr.length-1);
var my_format:TextFormat = new TextFormat();
if (select == 1) {
my_format.font = "Times";
} else if (select == 2) {
my_format.font = "Calibri";
} else if (select == 3) {
my_format.font = "Aparajita";
} else if (select == 4) {
my_format.font = "Tahoma";
} else if (select == 5) {
my_format.font = "Trebuchet MS";
} else if (select == 6) {
my_format.font = "Verdana";
}
my_format.color = 0xFF0000;
my_format.size = 24;
var ind:TextField = this.createTextField("ind", this.getNextHighestDepth(), 10, 10, 300, 30);
ind.text = "In...";
ind.antiAliasType = "advanced";
ind.border = false;
ind.embedFonts = true;
ind._x = 200;
ind._y = 250;
ind._rotation = Math.round (Math.random ()*90)-45;
ind._alpha = 100;
ind.setTextFormat(my_format);
ind.getTextFormat();
and then apply this text format to the next syllable.