Typewriter effect with a button
Hello... hm, i would like to have a button, a dynamic text and an input text.
When i will click on the button, the input text will be show in the dynamic text, with a typewriter effect.
I found this script... (a cool script with a sound, when the typewriter effect works)
var mysound =new kb();
mysound.play();
var myString:String = origine.text;
var myArray:Array = myString.split("");// seperates each letter
addEventListener(Event.ENTER_FRAME, frameHandler);
function frameHandler(event:Event):void {
if (myArray.length > 0) {
resultat.appendText(myArray.shift());
} else {
removeEventListener(Event.ENTER_FRAME, frameHandler);
SoundMixer.stopAll();
}
}
So it works when i launch the swf, but... I don't know the correct way to make it with a button...
bouton.addEventListener(MouseEvent.CLICK, gogogo);
function gogogo(event:MouseEvent):void {
//???
}
I don't find it. Any idea, please?