Animating Dynamic text onto the screen letter by letter
Posted on 16. Apr, 2009 by thornyeternity in ActionScript 3 Snippets
private function setInitialContentForCaseStudy():void{
more_mc.solution_txt.text = “”;//clear to start
solutionString = solutionsArray[0];
animationCounter = 0;
animationTimer = new Timer(100, 0);
animationTimer.addEventListener(TimerEvent.TIMER, animateContent);
animationTimer.start();
}//setInitialContentForCaseStudy
private function animateContent(event:TimerEvent):void{
more_mc.solution_txt.appendText(solutionString.charAt(animationCounter));
animationCounter++;
if(animationCounter == solutionString.length){
animationTimer.stop();
}//if
}//animateContent
Beware of other stuff happening at same time or too much text – can be slow!


