If I wanted to create a button that would clear all text a visitor has typed into a separate text box, named “page”, how would I do that? I’ve tried using the following actionscript on the button but to no avail:
it works fine for me - post a fla or email it to me and i will try to fix it…before you do, double check all your instance naming, referencing and syntax, as there is no reason why _root.page.text = " "; shouldnt work if the input textfield is really on the _root. timeline and is called “page”.
I want to make the star-like button at the top left clear the text field in the middle.
Maybe I’m having problems because the text field is in a movie clip? It works fine for another button I have that prints the text field (the piece of paper). But I’m fairly new at Actionscript so perhaps I’m missing something really basic… As far as I can tell everything is named correctly…
Actually, putting in page.page worked to clear the field when the swf was opened, but if I typed in words and then pressed the button, it didn’t clear them. Why woud that be?
ok i renamed the input text inside the “page” movie clip to “textbox”. I also renamed the input text’s variable to “pageVar”.
it works fine using
on (release) {
_root.page.textbox.text = "";
}
its not a good idea to use the same word for so many things, ie the movie clip called “page”, then you called the textbox inside it “page” again, then you called the variable for the textbox “page” again
Thanks a ton. Next time I will use better naming! I had thought that if I named everything similar with that movie clip, it would make things easier. Heh. :ne: I guess that’s what you get when you’re new to actionscript!