Skip to main content
August 30, 2011
Question

TextField.setTextFormat() doesn't read indexes in cs5.5

  • August 30, 2011
  • 1 reply
  • 882 views

I have a TLFTextfield, which I've applied a TextFormat to, using a start and end index so it only applies to a range of text.

Something similar to this:

var textfield:TLFTextField = new TLFTextField();

textfield.text = "Some Text";

textfield.textColor = 0x0000FF;

addChild(textfield);


var tf:TextFormat = new TextFormat(null,null,0xFFFF00);

textfield.setTextFormat(tf,4,6);

From what I remember in Flash CS5, this works as it should. The text from index 4 to 6 changed to yellow while the rest stays blue.

This also still works perfect with a normal TextField.

But in Flash CS5.5, when applying a TextFormat to a TLFTextField, it applies it to the entire TextField, regardless of the startIndex and endIndex on the TextFormat. The whole phrase changes to yellow.

Has anyone else encountered this?

This topic has been closed for replies.

1 reply

Participating Frequently
February 10, 2012

I am also having this problem with TLFTextField.setTextFormat() in CS5.5.

The setTextFormat() beginIndex and endIndex parameters only seem to work with classic TextFields but NOT with TLFTextFields.

kglad
Community Expert
Community Expert
February 12, 2012

that's a bug.