TextArea.htmlText FIXED!

September 17th, 2008 § 3

I have been having an issue with setting htmlText with img tags embeded. Usually the first time you set the htmlText of a text field it is ok, but when you set it again you get an error:

The supplied DisplayObject must be a child of the caller

There was no elegant solution to this so I have created one. Here it is…


package ****{
import mx.core.mx_internal;
use namespace mx_internal;

import mx.controls.TextArea;

public class FixedTextArea extends TextArea{
public function FixedTextArea(){
super();
}

override public function set htmlText(value:String):void{
mx_internal::removeTextField();
mx_internal::createTextField(-1);

super.htmlText = value;
}

}
}


It’s never been easy to download movies.

§ 3 Responses to “TextArea.htmlText FIXED!”

  • Nakul says:

    This TextArea fix is amazing! However, I want to the TextArea editable=false as well.

    After inserting the code mentioned above, the editable=false is having no effect.

    Kindly let me know how this can be done.
    Thanks!

  • Nakul says:

    Found a solutions. For the textArea, I added this:

    textInput=”event.preventDefault()”

    This works fine.

  • David says:

    Hi, how can I use this class?
    I’ve already created and imported into my stage but should I create a new FixedTextArea() or my current textarea will inherits the method?

    Thanks

  • § Leave a Reply

What's this?

You are currently reading TextArea.htmlText FIXED! at Digital John.

meta