0
Community Beginner
,
/t5/animate-discussions/action-script-code-for-focus/td-p/139694
Sep 26, 2008
Sep 26, 2008
Copy link to clipboard
Copied
Can someone please help. I just need the script necessary to
force the curser from one text field to another when pressing the
tab key. Here's some script that I found in the template I
purchased. But this seems to be used to control color, not the
progression of text field selection by pressing the tab button. By
the way, this is the only place in the action script where the
word, "Focus" appears, but the tab works until you get to the
"State" field at which point it skips to a dropdown menu.
Can someone set me straight? Here's the script:
//Changes the background colors on focus as well as removing the text currently in the textbox.
nameTxt.onSetFocus = function() {
nameTxt.text="";
nameTxt.backgroundColor = tbgColorOn;
emailTxt.backgroundColor = addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
emailTxt.onSetFocus = function() {
emailTxt.text="";
emailTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
addressTxt.onSetFocus = function() {
addressTxt.text="";
addressTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
cityTxt.onSetFocus = function() {
cityTxt.text="";
cityTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
stateTxt.onSetFocus = zipTxt.onSetFocus=function() {
stateTxt.text="";
stateTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=cityTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
zipTxt.onSetFocus = ageTxt.onSetFocus = function() {
zipTxt.text="";
zipTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
ageTxt.onSetFocus = function() {
ageTxt.text="";
ageTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
genderTxt.onSetFocus = function() {
genderTxt.text="";
genderTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=cityTxt.backgroundColor=addressTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
descTxt.onSetFocus = function() {
descTxt.text="";
descTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=addressTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=tbgColorOff;
};
Can someone set me straight? Here's the script:
//Changes the background colors on focus as well as removing the text currently in the textbox.
nameTxt.onSetFocus = function() {
nameTxt.text="";
nameTxt.backgroundColor = tbgColorOn;
emailTxt.backgroundColor = addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
emailTxt.onSetFocus = function() {
emailTxt.text="";
emailTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
addressTxt.onSetFocus = function() {
addressTxt.text="";
addressTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
cityTxt.onSetFocus = function() {
cityTxt.text="";
cityTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
stateTxt.onSetFocus = zipTxt.onSetFocus=function() {
stateTxt.text="";
stateTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=cityTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
zipTxt.onSetFocus = ageTxt.onSetFocus = function() {
zipTxt.text="";
zipTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
ageTxt.onSetFocus = function() {
ageTxt.text="";
ageTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=addressTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=zipTxt.backgroundColor=genderTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
genderTxt.onSetFocus = function() {
genderTxt.text="";
genderTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=cityTxt.backgroundColor=addressTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=descTxt.backgroundColor=tbgColorOff;
};
descTxt.onSetFocus = function() {
descTxt.text="";
descTxt.backgroundColor = tbgColorOn;
nameTxt.backgroundColor = emailTxt.backgroundColor=cityTxt.backgroundColor=stateTxt.backgroundColor=addressTxt.backgroundColor=zipTxt.backgroundColor=ageTxt.backgroundColor=genderTxt.backgroundColor=tbgColorOff;
};
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Community Beginner
,
Sep 26, 2008
Sep 26, 2008
NEVER MIND> I FIGURED IT OUT!!!
Community Beginner
,
LATEST
/t5/animate-discussions/action-script-code-for-focus/m-p/139695#M333401
Sep 26, 2008
Sep 26, 2008
Copy link to clipboard
Copied
NEVER MIND> I FIGURED IT OUT!!!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

