forked from: TextField_animation01
forked from TextField_animation01 (diff: 39)
... @author ...
ActionScript3 source code
/**
* Copyright hacker_yk666qry ( http://wonderfl.net/user/hacker_yk666qry )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/67xx
*/
package
{
import flash.display.Sprite;
import flash.events.TimerEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.utils.Timer;
/**
* ...
* @author ...
*/
public class MyTextField extends Sprite
{
public var tf:TextField;
public var msg:String = "楽しいActionScriptの世界へ";
public var timer:Timer;
public function MyTextField() {
var format:TextFormat = new TextFormat();
format.align = TextFormatAlign.CENTER;
tf = new TextField();
tf.autoSize = TextFieldAutoSize.LEFT;
tf.defaultTextFormat = format;
addChild( tf );
timer = new Timer( 100, msg.length );
timer.addEventListener(TimerEvent.TIMER, timerHandler );
timer.start();
}
public function timerHandler( e:TimerEvent ):void {
var char:String = msg.charAt( timer.currentCount - 1 );
tf.appendText( char );
}
}
}
