Return to Snippet

Revision: 17215
at August 27, 2009 10:28 by sidneydekoning


Initial Code
// 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;
		}
	}

Initial URL

                                

Initial Description

                                

Initial Title
Set selection to a textfield

Initial Tags

                                

Initial Language
ActionScript 3