Is there a simple way to generate a delay within a function.
I am trying to create a typewriter simulation of text, but require
a delay when the next letter is chosen. I have tried using a
standard for loop, which should technically work. But it creates
one big delay then displays the result.
the flaw in your code is that the stage is updated every
frame, and all your code is contained within one frame i.e. all of
your letters have to be added to your dynamic text box variable
before it gets displayed.
What you'd be after is either an onEnterFrame which performs
an action every frame, or probably even better would be setInterval
which performs an action every x milliseconds: