Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 108516

Typewriter effect skip to end

$
0
0

Ok so this has been bugging me for awhile a so far I've ignored it because it's not a huge deal but I have a type writer effect using the code below, the problem is I want, when a button is clicked, for it to finish completely. Just jump right to the end. Basically the typing starts and then when said button is clicked, it displays all the text as opposed to just stopping in the middle or heading to the next frame.

 

I've seen ways to restart it, ways to stop it in the middle, but I've yet to see a way for it to quickly finish. I don't care if I need to replace the code I'd just like to be able to do this.

 

var myString:String = "text text text text text text text text text text text text text text text text text text text text text text ";

var myArray:Array = myString.split("");// seperates each letter

 

 

addEventListener(Event.ENTER_FRAME, frameHandler);

function frameHandler(event:Event):void {

    if (myArray.length > 0) {

    myText.appendText(myArray.shift());

   

    } else {

      removeEventListener(Event.ENTER_FRAME, frameHandler);

    }

}


Viewing all articles
Browse latest Browse all 108516

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>