Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-31-2004, 05:05 PM   #1
timothye
Registered User
 
timothye's Avatar
 
Join Date: Jan 2004
Location: Sweden/Sverige/USA
Posts: 106
Default textField question

i have a input textField . and i have "name" typed in the textField ..
is it possible for this textField , when i click on it to make the existing text disappear when i click in the textField .then typ in the info ?
i have been trying to do this out of pure couriosity..here is my code that i dont know what im doing here ..
Code:
 //name here in dynamic textField
my_txt.text = "Name here";
my_txt.onChanged = function(txt) {
	trace(txt._name+"changed");
	my_txt.text = "";
};
my_listener = new Object();
my_listener.onChanged = function(txt) {
	my_txt.text = my_txt.text;
	trace(txt._name+"new text");
};
my_txt.addListener(my_listener);
this basically clears the text Field . but then doesnt receive any text typed in after the onChanged <-
thanks for anysuggestions
timothye is offline   Reply With Quote
Old 03-31-2004, 10:37 PM   #2
jubei
Chunky Samurai
 
jubei's Avatar
 
Join Date: Jun 2002
Location: Adelaide, Australia
Posts: 469
Send a message via ICQ to jubei Send a message via AIM to jubei Send a message via MSN to jubei Send a message via Yahoo to jubei
Default

It's not letting you type anything in because onChanged is called every time something is typed in, and clearing the text box.

Try onSetFocus instead, which is only triggered when you click the box. All you really need is

Code:
my_txt.text = "Name here";
my_txt.onSetFocus = function() {
	my_txt.text = "";
};

Last edited by jubei; 03-31-2004 at 10:39 PM.
jubei is offline   Reply With Quote
Old 03-31-2004, 11:00 PM   #3
timothye
Registered User
 
timothye's Avatar
 
Join Date: Jan 2004
Location: Sweden/Sverige/USA
Posts: 106
Default

hey that is what i had going in the first place .. but the onyl problem with that is it doesnt display "name here" its blank as soon as you enter that frame .. not unless i am doing something wrong ..
timothye is offline   Reply With Quote
Old 03-31-2004, 11:05 PM   #4
jubei
Chunky Samurai
 
jubei's Avatar
 
Join Date: Jun 2002
Location: Adelaide, Australia
Posts: 469
Send a message via ICQ to jubei Send a message via AIM to jubei Send a message via MSN to jubei Send a message via Yahoo to jubei
Default

I'm not sure. I tested it, and it worked fine for me. Give it a go.. make a new file, create your text box, and add that code to the frame, then export it. If that doesn't work for you, post the .fla somewhere, because that's exactly what I did, and it seemed fine
jubei is offline   Reply With Quote
Old 03-31-2004, 11:22 PM   #5
timothye
Registered User
 
timothye's Avatar
 
Join Date: Jan 2004
Location: Sweden/Sverige/USA
Posts: 106
Default

got it !!
thanks for you help .. very much appreciated ..
timothye is offline   Reply With Quote
Old 03-31-2004, 11:32 PM   #6
jubei
Chunky Samurai
 
jubei's Avatar
 
Join Date: Jun 2002
Location: Adelaide, Australia
Posts: 469
Send a message via ICQ to jubei Send a message via AIM to jubei Send a message via MSN to jubei Send a message via Yahoo to jubei
Default

No worries
jubei is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:21 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.