Andreas, if i understood you correct, what you want is this:

var format1_fmt:TextFormat = new TextFormat();
format1_fmt.font = "Arial";
var format2_fmt:TextFormat = new TextFormat();
format2_fmt.font = "Courier";

var string1:String = "Sample string number one."+newline;
var string2:String = "Sample string number two."+newline;

this.createTextField("my_txt", this.getNextHighestDepth(), 0, 0, 300, 200);
my_txt.multiline = true;
my_txt.wordWrap = true;
my_txt.text = string1;
var firstIndex:Number = my_txt.length;
my_txt.text += string2;
var secondIndex:Number = my_txt.length;

my_txt.setTextFormat(0, firstIndex, format1_fmt);
my_txt.setTextFormat(firstIndex, secondIndex, format2_fmt);

Rodrigo


On 4/21/06, Andreas Rønning <[EMAIL PROTECTED]> wrote:
>
> Ok i'm confused.
>
> fmtOne = new TextFormat("Arial",20);
> fmtTwo = new TextFormat("Arial",40);
> blah = _root.createTextField("myField",10,0,0,100,100);
> blah.autoSize = true;
> blah.setNewTextFormat(fmtOne);
> blah.text+="First ";
> blah.setNewTextFormat(fmtTwo);
> blah.text+="Second";
>
> In my mind, based on what the docs say about setNewTextFormat and on
> what i'm 99% sure i've done before in some circumstance, the text field
> in this case should contain a small "First" and a larger "Second".
> Instead setNewTextFormat() is acting like setTextFormat, setting all the
> text to fmtTwo. Is there a reason for this? If i try setting SPECIFIC
> letters to a textformat with setTextFormat(from,to,format) it works fine.
>
> I thought setNewTextFormat() only affects text added to the textField
> AFTER it has been called, not the complete field at any time, anywhere.
>
> As a better example of the kind of use i have for it; the actual problem
> AS:
>
> function sum() {
>    var count = 17;
>    var langCount = 4;
>    var searchString = "A name";
>    var norm_fmt:TextFormat = new TextFormat();
>    norm_fmt.color = 0xFFFFFF;
>    norm_fmt.size = 16;
>    norm_fmt.font = "ConduitNorm";
>    var bold_fmt:TextFormat = new TextFormat();
>    bold_fmt.color = 0xEFB21E;
>    bold_fmt.size = 18;
>    bold_fmt.font = "ConduitBold";
>    sumField.text = "";
>    sumField.embedFonts = true;
>    sumField.setNewTextFormat(bold_fmt);
>    sumField.text += count;
>    sumField.setNewTextFormat(norm_fmt);
>    sumField.text += " NameTones in ";
>    sumField.setNewTextFormat(bold_fmt);
>    sumField.text += langCount;
>    sumField.setNewTextFormat(norm_fmt);
>    sumField.text += " different languages, was found on: ";
>    sumField.setNewTextFormat(bold_fmt);
>    sumField.text += searchString;
> }
>
> As above, all the text is set to bold_fmt, which is not cool
>
> - Andreas
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to