/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// To set selection a textfield, use the following; var _textInput1:TextField = new TextField(); _textInput1.addEventListener(Event.CHANGE, handleTextChange, false, 0, true); function handleTextChange(event:Event):void { switch(event.target){ case _textInput1: trace("input 1"); if(_textInput1.text.length == 2) { stage.focus = _textInput2; _textInput2.setSelection(0, _textInput2.text.length); // or second param equals 0 -> 0,0 } break; } }
Comments
