Hi,
The following is the code which acts as Type Writing text effect. I am working on AS3 while the following code sample which I downloaded is in AS2. How it can be edited to AS3 code, please?
The following is code:
var i:Number = 0;
// the message that is going to displayed in the dynamic text field
var myMessage:String = "CLASSIFIED INFORMATION - EYES ONLY: The text you are reading right now is made with a simple dynamic text field and a small piece of ActionScript code.
You are going to learn how to create this effect right now by following my tutorial.
Click the REPEAT button below this text if you wish to see again how nicely the text appears all by itself. Ain't it great? :)";
// the function that makes the effect possible
function autoWrite():Void {
if (i<=myMessage.length) {
monitor_txt.text = myMessage.substr(0, i)+"█";
i = i+1;
} else {
clearInterval(writingInterval);
}
}
// calling the function repeatedly with setInterval() method
var writingInterval:Number = setInterval(autoWrite, 20);
// button functionality
restart_btn.onRelease = function():Void {
i = 0;
writingInterval = setInterval(autoWrite, 20);
}
Regards.