I have a problem formatting a text field that is written in by a tipewritter class that i found here. Here is my code:
[AS]import typewriter;
var newTypewriter:typewriter = new typewriter;
var outputTextBox:TextField = new TextField();
outputTextBox.multiline = true;
outputTextBox.selectable = false;
outputTextBox.width = 200;
outputTextBox.wordWrap = true;
//outputTextBox.embedFonts = true;
var outputTextBox1:TextField = new TextField();
outputTextBox1.multiline = true;
outputTextBox1.selectable = false;
outputTextBox1.width = 200;
outputTextBox1.wordWrap = true;
//outputTextBox1.embedFonts = true;
var framesCounter:Number = 0;
stage.addEventListener(Event.ENTER_FRAME, showText);
function showText(event:Event):void
{
framesCounter ++;
trace(framesCounter);
if(framesCounter == 20)
{
addChild(outputTextBox);
var firstMessage:String = "text that i would like to display";
newTypewriter.writeIt(firstMessage, outputTextBox, 90);
var myFormat:TextFormat = new TextFormat();
myFormat.font = "Humanst521 Cn BT";
myFormat.size = 20;
outputTextBox.setTextFormat(myFormat);
}
}
[/AS]
And it does not work. It only writes in Times new Roman with size 12. I tryed setting textField.text = firstMessage and that makes the firstMessage text appear instantly (it is set as text of text field) in correct formmating and than typewriter writes firstMessage in the correct formmating but only after first text witch it same. How can i format this text field to my needs and with firstMessage apperaing only once? I tryed setting text of the field to “” and so on an nothing seams to work exept that text appears twice.
any ideas please?
regards
Luka