TextField Properties and Class Functions

by Tecno
Me testing the TextField Class.
♥0 | Line 36 | Modified 2016-02-17 23:46:26 | MIT License
play

ActionScript3 source code

/**
 * Copyright Tecno ( http://wonderfl.net/user/Tecno )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/9v6x
 */

//Why background color still white?

package {
    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.text.TextField;
    import flash.events.Event;
    
    [SWF(frameRate = 5, width = 70, height = 70, backgroundColor = 0x0)]
    
    public class FlashText extends Sprite 
        { 
        private var texto:TextField = new TextField();
        private var texto2:TextField = new TextField();
        private var tsel:int = 0; //Text Pointer
        public function FlashText() {
            texto2.y = 12;
            texto.textColor = 0x44; //Setting TextField color to something like "dark blue".
            texto.text = "Revolution";
            //o//texto.text = "¡Hola, mudo!";
            texto.wordWrap = true;
            addChild(texto);
            addChild(texto2);
            addEventListener(Event.ENTER_FRAME, loop);
        }
        
        private function loop(e:Event):void
        {
            //X//texto.text = String(int(texto.text) + texto.length);
            texto2.text = texto.text.charAt(tsel);
            texto2.x = tsel * 6;
            if(tsel > texto.length)
            {
                tsel = 0;
            }
            else
            {
                tsel ++;
            }
        }
    }
}