Check this out
http://juliankussman.com/blog/wp-content/uploads/2008/04/textformatsticking.swf
Click the button to change the text. Then at some point, click on the text and then click the button again. The defaultTextFormat goes away.
Here is the code:
var titleTF:TextFormat = new TextFormat();
titleTF.color = 0xFF00FF;
titleTF.size = 22;
//titleTF.font = avantBold.fontName;
var titleText:TextField = createTF(10, 10, 200, 26, true, titleTF, “This is a test”);
addChild(titleText);
function createTF(_x:Number, _y:Number, _width:Number, _height:Number, _autoSize:Boolean, _defaultTF:TextFormat, _text:String):TextField {[INDENT] var tf:TextField = new TextField();
tf.x = _x;
tf.y = _y;
tf.width = _width;
tf.height = _height;
tf.autoSize = (_autoSize) ? TextFieldAutoSize.LEFT : TextFieldAutoSize.NONE;
tf.wordWrap = true;
tf.multiline = true;
tf.defaultTextFormat = _defaultTF;
tf.htmlText = _text;
//tf.setTextFormat(_defaultTF);
return tf;
[/INDENT]}
clicker.addEventListener(MouseEvent.CLICK, swapText);
function swapText(e:*):void{[INDENT] titleText.htmlText = “This is now a changed test” + String(Math.random());
[/INDENT]}
Any help?