I have a simple actionscript function
var string:String = "TEXT REMOVED";
var myArray:Array = string.split("");
addEventListener(Event.ENTER_FRAME, frameLooper);
function frameLooper(event:Event):void {
if(myArray.length > 0) {
text1.appendText(myArray.shift());
}else{
removeEventListener(Event.ENTER_FRAME, frameLooper);
}
}
And I want to have it sleep after calling the framelooper so it is a little bit slower. How could I do this?
btw, I’m fairly new and found this code on a tutorial, it’s a text typing effect, if there is a better way of doing this please let me know.
Use a Timer:
This will execute the frameLooper on every second for exactly as many times as the length of the array.