Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Action Script code for focus

Community Beginner ,
Sep 26, 2008 Sep 26, 2008
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;
};
TOPICS
ActionScript
199
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Sep 26, 2008 Sep 26, 2008
NEVER MIND> I FIGURED IT OUT!!!
Translate
Community Beginner ,
Sep 26, 2008 Sep 26, 2008
LATEST
NEVER MIND> I FIGURED IT OUT!!!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines