Need help with "setFocus"

Hi,

How to change focus from text field 1 to text field 2 if the user types in one character in text field 1??

This is my best guess…

if (text1.length == 1) setFocus("text2");

Is my code totaly wrong or am I on the right track??


text1.length>=1 ? Selection.setFocus("_root.text2InstanceName") : null;

…Welcome:)

Thanks for your answer nathan99,

I can´t get it to work the way I want.
I post a .fla so you can take a look, if you want


i = 1;
order = ["text2","text3"/*etc....*/]
//the order to set the focuses
while (this["text"+(i+1)]) {
	this["text"+i].id
	this["text"+i].onChanged = function() {
		this["text"+i].length>=1 ? Selection.setFocus(order[this.id-1]) : null;
	}
	i++;
}