Input Text Question

Let me get right to the point – You’ve seen those Input Text Fields on web sites that have titles on them, i.e. Name, Email, Message, in the Text field itself.

Then, when you click on the the text field to type something in, the “title” disappears and you can type your info in.

Perfect example: KurtNoble.com (Under “contact”)

How do I do this?

AS Panel>Objects>Movie>Text Field>Methods>onSetFocus
go play :wink:

Prophet.

Very close… it was: AS Panel>Objects>Movie>Text Field>Events>onSetFocus

Even so, that wasn’t much help to me… how about an explanation, or the ActionScript itself? :beam:

Thanks anyway.

you can test this:

input.onSetFocus=function(){
input.text=" ";
}

“input” is your textfield name.

Hey egoldy, I tried that earlier today and it does work. However, the thing I don’t like is that if you click on it a second time (once you’ve already typed something in it), it also erases that… and I don’t want people’s info being erased.

please check out my attachment files.

oh!.cannot upload?

http://www.bggt.com.cn/ego/design/test1.swf
fla:
http://www.bggt.com.cn/ego/design/emailtest1.rar

Okay, attach them and I’ll take a look at em’ :stuck_out_tongue: .

Edit: Oh there they are.

you always online?

Okay, that’s what I want, any chance you can post the .fla?
I’m not sure what the .rar file is for… if you can’t upload the .fla you could also email it to me at: forumwizard[at]yahoo.com

Thanks :thumb:

the .rar file is fla .

you are welcome.

Ahhh, Mac.

add this AS into your first frame:

function focusToggle(name) {
if (this[name].text != “”) {
if (this[“tempStr_”+name] == null) {
this[“tempStr_”+name] = this[name].text;
trace(this[“tempStr_”+name]);
}
if (this[name].text == this[“tempStr_”+name]) {
this[name].text = “”;
}
} else {
this[name].text = this[“tempStr_”+name];
}
}

a.tabIndex = 1;
b.tabIndex = 2;
c.tabIndex = 3;
d.tabIndex = 4;
a.onSetFocus = function() {
focusToggle(“a”);
};
a.onKillFocus = function() {
focusToggle(“a”);
};
b.onSetFocus = function() {
focusToggle(“b”);
};
b.onKillFocus = function() {
focusToggle(“b”);
};
c.onKillFocus = function() {
focusToggle(“c”);
};
c.onSetFocus = function() {
focusToggle(“c”);
};
d.onSetFocus = function() {
focusToggle(“d”);
};
d.onKillFocus = function() {
focusToggle(“d”);
};

a,b,c,d, is instanceName of the inputTextField.

If you want to make every thing from scratch add this to your first frame:

//tab index of input text fields

name_str.tabIndex = 1;
company_str.tabIndex = 2;
email_str.tabIndex = 3;
subject_str.tabIndex = 4;
message_str.tabIndex = 5;

//input text field lables

name_str.text = “Name”;
company_str.text = “Company”;
email_str.text = “Email”;
subject_str.text = “Subject”;
message_str.text = “Message”;

//clear input text field onFocus, if something typed in don’t clear input text field, if nothing typed in rename input text field onFocusKill

name_str.onSetFocus = function() {
if (name_str.text == “Name”) {
name_str.text = “”;
}
};
name_str.onKillFocus = function() {
if (name_str.text == “”) {
name_str.text = “Name”;
}
};
company_str.onSetFocus = function() {
if (company_str.text == “Company”) {
company_str.text = “”;
}
};
company_str.onKillFocus = function() {
if (company_str.text == “”) {
company_str.text = “Company”;
}
};
email_str.onSetFocus = function() {
if (email_str.text == “Email”) {
email_str.text = “”;
}
};
email_str.onKillFocus = function() {
if (email_str.text == “”) {
email_str.text = “Email”;
}
};
subject_str.onSetFocus = function() {
if (subject_str.text == “Subject”) {
subject_str.text = “”;
}
};
subject_str.onKillFocus = function() {
if (subject_str.text == “”) {
subject_str.text = “Subject”;
}
};
message_str.onSetFocus = function() {
if (message_str.text == “Message”) {
message_str.text = “”;
}
};
message_str.onKillFocus = function() {
if (message_str.text == “”) {
message_str.text = “Message”;
}
};

name_str, company_str, email_str, subject_str, message_str, is the intance names of the input text fields

holy jeezus… no, i didnt read all of the above… just thought id tell wizard to put an IF statement before he changes the value of his text box to nothing to see if its current value is equal to its default:

input.onSetFocus=function(){
    if(input.text == "This was the text you had in here before users put their input in"){
        input.text=""
    }
}

Prophet.

headznet that worked perfectly… thank you very much :} .

And thanks to everyone else for your inputs as well, thank you.