cki
November 9th, 2004, 04:57 PM
Hi in the follwoing code I'm attempting to make the reset button set all of the textField messages in the hintList[] to null. I'm missing the point.
reset_btn.fieldRef.onRelease = function() {
show("");
};
//added in version 1.2
function show(message) {
message_txt.text = message;
}
//Create an associative array of textfield instance names
//and hint messages.
hintList = [];
hintList["noun_txt"] = "Type in a plural noun.";
hintList["bodyPart_txt"] = "Type in a body part.";
hintList["verb_txt"] = "Type in a verb.";
hintList["name_txt"] = "Type in a proper name.";
hintList["politician_txt"] = "Type in a politician name.";
hintList["adjective_txt"] = "Type in an adjective.";
//
//Loop through all the elements in the array.
for (var n in hintList) {
//use the hash key to create a reference to the textfield.
var fieldRef = this[n];
//Define a hint property in the textfield with the value
//of the hintList element
fieldRef.hint = hintList[n];
//When the textfield gains focus, trigger the show function
//With the message of the textfield's hint property.
fieldRef.onSetFocus = function() {
show(this.hint);
};
fieldRef.onKillFocus = function() {
show("");
};
}
//End of version 1.2 changes
reset_btn.fieldRef.onRelease = function() {
show("");
};
//added in version 1.2
function show(message) {
message_txt.text = message;
}
//Create an associative array of textfield instance names
//and hint messages.
hintList = [];
hintList["noun_txt"] = "Type in a plural noun.";
hintList["bodyPart_txt"] = "Type in a body part.";
hintList["verb_txt"] = "Type in a verb.";
hintList["name_txt"] = "Type in a proper name.";
hintList["politician_txt"] = "Type in a politician name.";
hintList["adjective_txt"] = "Type in an adjective.";
//
//Loop through all the elements in the array.
for (var n in hintList) {
//use the hash key to create a reference to the textfield.
var fieldRef = this[n];
//Define a hint property in the textfield with the value
//of the hintList element
fieldRef.hint = hintList[n];
//When the textfield gains focus, trigger the show function
//With the message of the textfield's hint property.
fieldRef.onSetFocus = function() {
show(this.hint);
};
fieldRef.onKillFocus = function() {
show("");
};
}
//End of version 1.2 changes