AS.tuces – Tabulation automatique entre des Textfields en AS3

package
{
    import flash.display.Sprite;
    import flash.events.KeyboardEvent;
 
    public class Main extends Sprite
    {
        public function Main():void
        {
            mcSubmit.visible = false;
            stage.addEventListener(KeyboardEvent.KEY_UP, checkTextField);
        }
 
        private function autoTab(...textfields):void
        {
            var l:int = textfields.length;
 
            for (var i:int = 0; i < l; i++)
            {
                if (textfields[i].length == textfields[i].maxChars)
                {
                    stage.focus = textfields[i + 1];
                }
                if (textfields[l - 1].length == textfields[l- 1].maxChars)
                {
                    mcSubmit.visible = true;
                }
            }
        }
 
        private function checkTextField(e:KeyboardEvent):void
        {
            autoTab(txt1, txt2, txt3);
        }
    }
}

0f485e11b4989cf1248f60281c32bdfa.