Animating a TextField horizontally to x-coordinate 300 : Animation : TextField Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » TextField » Animation »

 

Animating a TextField horizontally to x-coordinate 300


 
package {
  import flash.display.*;
  import flash.events.*;
  import flash.text.*;

  public class Main extends Sprite {
    private var t:TextField = new TextField(  );

    public function Main (  ) {
      t.text          = "Hello";
      t.autoSize      = TextFieldAutoSize.LEFT;
      addChild(t);

      addEventListener(Event.ENTER_FRAME, moveTextRight);
    }

    public function moveTextRight (e:Event):void {
      if (t.x <= 300) {
        t.x += 10;
        if (t.x > 300) {
          t.x = 300;
        }
      else {
        removeEventListener(Event.ENTER_FRAME, moveTextRight);
      }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo TextField
» Animation