PDA

View Full Version : ComboBox & Text Input


donaldparkerii
05-24-2006, 11:03 PM
Here is my code everything works perfect with the excption if i add
group_cmb.onKillFocus = validateGroup; or for anyother combobox
, when you kill the focus and start typing in a Text Input the combo box will scroll to which ever letter you typed (if is has that value). any ideas?

function validateName():Void{
if (name_txt.length == 0) {
nameValidate_txt.text = "PLEASE ENTER YOUR NAME";
field1 = false;
} else if (name_txt.length>0) {
nameValidate_txt.text = "";
field1 = true;
}
}
function validateID():Void{
if (empID_txt.length == 0) {
idValidate_txt.text = "PLEASE ENTER YOUR EMPLOYEE ID";
} else if (empID_txt.length>0) {
idValidate_txt.text = "";
}
}
function validateGroup():Void{
if (group_cmb.selectedIndex == 0) {
groupValidate_txt.text = "PLEASE SELECT YOUR GROUP";
} else if (group_cmb.selectedIndex>0) {
groupValidate_txt.text = "";
}
}
function validateDepo():Void{
if (department_cmb.selectedIndex == 0) {
depoValidate_txt.text = "PLEASE SELECT YOUR DEPARTMENT";
} else if (department_cmb.selectedIndex>0) {
depoValidate_txt.text = "";
}
}

function submit():Void{
validateName();
validateID();
validateGroup();
validateDepo();
Name = name_txt.text;
Employee_ID = empID_txt.text;
Group = group_cmb.text;
Department = department_cmb.text;
Training_Type = type_txt.text;
}


name_txt.onKillFocus = validateName;
empID_txt.onKillFocus = validateID;


submit_btn.onRelease = submit;

Xeef
05-24-2006, 11:20 PM
i am strugling whit the same type of problem !

a solution for yours is probably :


_cb.OldonKillFocus = _cb.onKillFocus;
_cb.onKillFocus = function() {
this.OldonKillFocus();
};

and here the "proper way"
as the ComboBox has NO onKillFocus
but as it is in the end, as everiting a MovieClip and this has onKillFocus
it will work
but
as you see just half way then MM is using in internal to manage the reactions of the CB as you over write it you get problems :p


listenerObject={}
listenerObject.focusOut = function(eventObject){
trace("Hallo")
}
_cb.addEventListener("focusOut", listenerObject)