PDA

View Full Version : [FMX]text field, onSetFocus and onKillFocus



dboers
April 14th, 2004, 04:55 AM
I'm making a form and i want to set a backgroundColor for the textfields onSetFocus and that the backgroundColors dissapear again onKillFocus. So far I have this code


naam.onSetFocus = function(){
this.background = true;
this.backgroundColor = 0xdddddd;
}
mail.onSetFocus = function(){
this.background = true;
this.backgroundColor = 0xdddddd;
}
naam.onKillFocus = function() {
naam.background = false
};
mail.onKillFocus = function() {
mail.background = false;
};

but to me it seems that there must be a way to combine all this lines of code into one single function or at least two one for the setFocus and one for the killFocus.

Somebody who know how to this?

claudio
April 14th, 2004, 10:16 AM
TextField.prototype.setBGcolor = function(RGB) {
this.onSetFocus = function() {
this.background = true;
this.backgroundColor = RGB;
};
this.onKillFocus = function() {
this.background = false;
};
};
//usage:
naam.setBGcolor(0xdddddd);
mail.setBGcolor(0xdddddd);

dboers
April 14th, 2004, 10:36 AM
Claudio Thubs up :) Thanks a lot ;)

claudio
April 14th, 2004, 10:42 AM
welcome :)

FlashPlaya
January 7th, 2005, 07:08 PM
That is great, once again claudio!!!!

I have one question though.. I have been trying to figure out for awhile now??

If you look at http://www.exopolis.com/site/ How the heck to they have the text change and come back like that.. Not the text effect. But when you go into each feild it changes back??

Thank!!!!