Text shows up in new textbox even though not told to.
So this is my problem. I'm working on making a text based game to learn a bit more coding but even after looking around I cannot find a way to fix this.
The point of the code is to have a type writer effect, I do have a button to make it jump to the end of the timer and show all the text at once but because it does not seem to be part of the issue I have omitted it from below.
What happens with the code below is that when the button is pressed a blank text box will appear instead of displaying the new sting of text. If the button is pressed before the text has finished typing the text that appears in the next frame will be the text that didn't have time to display.
I have tested by having the 2nd frame just be T1.text = "NewTexthere" and it worked correctly but when the type writer effect is applied it no longer works.
----Frame 1----
stop()
T1.text = ""
var i=0;
var myString:String = "Text"
var mytimer:Timer = new Timer(10,myString.length);
mytimer.addEventListener(TimerEvent.TIMER, timerHandler);
mytimer.start();
function timerHandler(event:TimerEvent):void{
T1.appendText (myString.charAt(i));
i++;
}
Button1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame);
function fl_ClickToGoToNextFrame(event:MouseEvent):void
{
nextFrame();
mytimer.stop();
}
-----Frame 2----
T1.text = ""
var i2=0;
var myString2:String = "NewTextHere"
var mytimer2:Timer = new Timer(10,myString.length);
mytimer2.addEventListener(TimerEvent.TIMER, timerHandler);
mytimer2.start();
function timerHandler2(event:TimerEvent):void{
T1.appendText (myString.charAt(i2));
i++;
}
---------
