Altering/expanding setTextFormat( ); function

Hi there, is there a way i can change the standard setTextFormat() ; function?
I found out that after you change the text, the format sets back to default. I want to add a “on text change, settextformat again” bit but im completely lost on how to do this? something to do with prototypes doesnt it?
Please help

this is what i have till now:


textField.prototype.setTextStyle = function(whichStyle) {
 this.onEnterFrame = function() {
  this.setTextFormat(whichStyle);
 };
};

Sadly it isnt working yet, and im afraid a onEnterFrame for every textfield will make it slow… any good ideas?

i don’t know why the textformat reset after change.
maybe you can try this:

textfield_txt.onChanged = function(){
textfield_txt.setTextFormat(fmt);
}

Got it, it seems i made a typo textField instead of TextField. After that it was pretty easy. Although this isnt pretty coding, it works fine.

TextField.prototype.setTextStyle = function(whichStyle) {
 texttarget = this;
 _root.onEnterFrame = function() {
  texttarget.setTextFormat(whichStyle);
 };
};
textfield_txt.setTextStyle(fmt);

Anyway thanks for the help/ Bedankt voor de hulp… tis een kleine wereld :wink: