# Modify text in textarea component

**URL:** <https://forum.kirupa.com/t/modify-text-in-textarea-component/257911>\
**Category:** Uncategorized\
**Created:** [April 18, 2008, 9:35am UTC](https://forum.kirupa.com/t/modify-text-in-textarea-component/257911 "2008-04-18T09:35:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fileslasher](https://avatars.discourse-cdn.com/v4/letter/f/4da419/32.png) [@fileslasher](https://forum.kirupa.com/u/fileslasher)\
**Post date:** [April 18, 2008, 9:35am UTC](https://forum.kirupa.com/t/modify-text-in-textarea-component/257911/1 "2008-04-18T09:35:23Z")

</div>

Hi all. I’m was wondering how to modify my text in a textarea component such as fontsize, color and creating a hyperlink if possible.

I’m getting text via xml and sending the text to flash. I want to modify that text in the textarea.

I created an event listener for urlloader and I display the text with a function. Here’s my code, the comments show what I’d like to modify.

```auto

textLoader.addEventListener("complete", textLoaded);
function textLoaded(event:Event):void {
    textXML = XML(textLoader.data);

    //Larger font size, with a different color
    itemText.text += textXML.item[0].product + "
";  
    
    //clickable link that opens browser window
    itemText.text += textXML.item[0].link + "
";    

}
 

```

---

<div class="post-metadata">

**Author:** ![fargenator](https://avatars.discourse-cdn.com/v4/letter/f/aca169/32.png) [@fargenator](https://forum.kirupa.com/u/fargenator)\
**Post date:** [June 16, 2008, 1:28pm UTC](https://forum.kirupa.com/t/modify-text-in-textarea-component/257911/2 "2008-06-16T13:28:42Z")

</div>

If you want to change _all_ the TextArea font properties within a TextArea component in AS3, you need to use the “setStyle()” method: [http://snipplr.com/view/4099/as3-adding-styles-to-a-textarea-component-using-new-textformat/](http://snipplr.com/view/4099/as3-adding-styles-to-a-textarea-component-using-new-textformat/)  
Otherwise, enable HTML within the textarea and then mark up your text with the standard tags.

---

<div class="post-metadata">

**Author:** ![Alex\_Lexcuk](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Alex\_Lexcuk](https://forum.kirupa.com/u/Alex_Lexcuk)\
**Post date:** [June 16, 2008, 2:01pm UTC](https://forum.kirupa.com/t/modify-text-in-textarea-component/257911/3 "2008-06-16T14:01:24Z")

</div>

I agree “setStyle()” solves all  
[http://dnadillo.dn.ua/fla/XML/img-xml.swf](http://dnadillo.dn.ua/fla/XML/img-xml.swf)  
[http://dnadillo.dn.ua/fla/XML/mur\_xml\_file\_img.xml](http://dnadillo.dn.ua/fla/XML/mur_xml_file_img.xml)

---

<div class="post-metadata">

**Author:** ![manuraj\_dhanda](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@manuraj\_dhanda](https://forum.kirupa.com/u/manuraj_dhanda)\
**Post date:** [June 16, 2008, 2:34pm UTC](https://forum.kirupa.com/t/modify-text-in-textarea-component/257911/4 "2008-06-16T14:34:14Z")

</div>

Hii, you can make use of htmlText here.  
I havn’t did it in my work yet, but it should work.

Here is your code with some modification:  
textLoader.addEventListener(“complete”, textLoaded);  
function textLoaded(event:Event):void {  
textXML = XML(textLoader.data);

```
//Larger font size, with a different color
itemText.text += textXML.item[0].product + "

```

“;  
itemAnotherText.text += “\<B\>\<FONT COLOR=’#000000’\>”+itemText.text+”\</FONT\>\<B\>  
";

```
//clickable link that opens browser window
itemText.text += textXML.item[0].link + "

```

“;  
itemAnotherText.text += “\<B\>\<A …\>”+itemText.text+”\<B\>  
";  
}

Where you should declare “itemAnotherText” as htmlText type.

Hope it 'll help you.  
Thanks.
