Hi everyone,
i can’t find an issue on this problem:
I have a prototype
TextField.prototype.changeHtmlText = function(texte:String, oldColor, effectSpeed, myTextStyle) {
oldColor = (oldColor == undefined) ? "#4A6C99" : oldColor;
if (myTextStyle == undefined) {
var myTextStyle = new TextField.StyleSheet();
myTextStyle.setStyle("a", {color:"#ff7800", textDecoration:"none"});
//links
myTextStyle.setStyle("a:hover", {color:"#99cc00", textDecoration:"none"});
//hover links
}
cx = this._parent.createEmptyMovieClip("texteTempControl"+this._parent.getNextHighestDepth(), this._parent.getNextHighestDepth());
this.styleSheet = myTextStyle;
if (cx.tempcaixadetexte == undefined) {
cx.createTextField("tempcaixadetexte", cx.getNextHighestDepth(), 0, 0, 0, 0);
}
cx.setTextFormat(textformat);
cx.tempcaixadetexte.htmlText = this.htmlText="<font color='"+oldColor+"'>"+this.text+"</font>";
cx.textefullsize = texte.length;
cx.thisfullsize = cx.tempcaixadetexte.text.length;
cx.texte = texte;
cx.effectSpeed = (effectSpeed == undefined) ? 5 : effectSpeed;
cx.caixa = this;
cx.onEnterFrame = function() {
this.effectSpeed = int(this.texte.length/this.effectSpeed)+1;
this.velActual = Math.min(this.effectSpeed, this.texte.length);
this.pedacotexte = this.texte.substr(-this.velActual);
if (this.pedacotexte.indexOf(">")>-1) {
this.velActual = this.texte.length-this.texte.lastIndexOf("<");
this.pedacotexte = this.texte.substr(-this.velActual);
}
this.texte = this.texte.slice(0, -this.velActual);
this.tempcaixadetexte.text = this.pedacotexte+this.tempcaixadetexte.text;
this.tempcaixadetexte.text = this.tempcaixadetexte.text.slice(0, this.textefullsize-this.texte.length+int(this.thisfullsize*(this.texte.length/this.textefullsize)));
this.caixa.htmlText = this.tempcaixadetexte.text+"</font>";
if (!this.texte.length) {
this.removeMovieClip();
}
};
};
this.createTextField("test", this.getNextHighestDepth(), 20, 20, 200, 200);
test.multiline = true;
test.html = true;
test.wordWrap = true;
//actual text
test.htmlText = "OLÁ, bem vindo,<br/><br/>Eu sou Paulo Afonso.<br/> o meu <a href='http://www.semmais.com'>site </a> e o meu <a href='http://forum.semmais.com'>fórum </a><br/><br/> Obrigado";
//new text
newText = "HELLO, welcome,welcome,welcome,welcome,<br/><br/>My name is Paulo Afonso, visit <a href='http://www.semmais.com'>website </a>, my <a href='http://forum.semmais.com'>fórum </a><br/><br/> thanks";
test.changeHtmlText(newText);
Try it to see what it does.
My problem is that i can’t use it if i want to embed a font and seriously i don’t understand why. I try to create a new textFormat, it doesn’t work. the only thing that works is when i add this :
cx.tempcaixadetexte.htmlText = this.htmlText="<font face='myfont' color='"+oldColor+"'>"+this.text+"</font>";
When it works weird.
If someone can lok at that and tell me what’s wrong i would appreciate.
Thank you again for your help.
Chris