I want to develop code that does the following:
(1) evaluate the information the user types into an input text field that is called prCv
(2) when there are 2 digits in the text field, I want the cursor to automatically move to the first position of the next text field, which is called pkgNum
(3) if the user typed 01 in the prCv field, I want the text color to change to green and display a message to Type 70 in the PKG NO field.
(4) if the user typed anything other than 01 in the prCv field, I want the text color to change to red and display an error message.
This code is not doing all that I want it to do. Any help would be greatly appreciated!
prCv.addEventListener(TextEvent.TEXT_INPUT, textChanged);
function textChanged(e:TextEvent) {
var x = prCv.text;
if (prCv.length > 1){
pkgNum.setSelection(0,0);}
if (x == “01”){
prCv.textColor = 0x00FF00;
messageBox.text = “Type 70 in the PKG NO field.”
}
else if (x != “01”){
prCv.textColor = 0xFF0000;
messageBox.text = “The correct prior coverage indicator is 01. Please correct this error.”;
}
if (prCv.length <= 1){
messageBox.text = “Type 01 in the PRCV field.”;
}
}