public class Main extends Sprite { private var t:TextField = new TextField( ); private var timer:Timer;
public function Main( ) { t.text = "Hello"; t.autoSize = TextFieldAutoSize.LEFT; addChild(t);
timer = new Timer(50, 0); timer.addEventListener(TimerEvent.TIMER, moveTextRight); timer.start( ); }
public function moveTextRight (e:TimerEvent):void { if (t.x <= 300) { t.x += 10; if (t.x > 300) { t.x = 300; } e.updateAfterEvent( ); // Update the screen following this function } else { timer.stop( ); } } } }
Related Scripts with Example Source Code in same category :