/**
* Copyright smallwind1912 ( http://wonderfl.net/user/smallwind1912 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/qGPB
*/
package {
import flash.text.TextField;
import flash.text.TextFormat;
import flash.display.*;
import flash.events.*;
public class FlashTest extends Sprite {
private var myText:String;
private var counter:int = 0;
private var textField:TextField;
public function FlashTest() {
// write as3 code here..
var format : TextFormat = new TextFormat();
format.size = 16;
format.font = "Verdana";
format.bold = true;
format.color = 0x000000;
textField= new TextField();
textField.width = 600;
textField.height = 350;
textField.selectable = false;
textField.wordWrap = true;
textField.defaultTextFormat = format;
textField.x = textField.y =10;
addChild(textField);
initText("Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool Hello wonderfl is so cool ");
}
private function initText(string:String):void{
myText = string;
addEventListener(Event.ENTER_FRAME, writeText);
}
private function writeText(e:Event):void{
if (counter <= myText.length){
textField.text = myText.substr(0,counter);
counter++;
}
else{
removeEventListener(Event.ENTER_FRAME,writeText);
}
}
}
}