# Help with resizing textArea component : Text getting streched

**URL:** https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615
**Category:** flash
**Created:** [July 6, 2004, 4:35am UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615 "2004-07-06T04:35:56Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![adityagaddam](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@adityagaddam](https://forum.kirupa.com/u/adityagaddam)
#### Post date: [July 6, 2004, 4:35am UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/1 "2004-07-06T04:35:56Z")

</div>

Hey guys,

I am currently working on a client’s website. I need some help though.

Problem:  
I have a textarea component. This textarea will have text loaded dynamically, so bascially I dont know what the maxVPosition is until runtime. I tried to resize the textarea so that the text doesn’t have to scroll, but this makes the font strech too… making it rather large. I have tried the following to counter this…

```auto

this._height += this.maxVPosition * (Number(font_size) + 10);
this.vScrollPolicy = "off";
font_size2 = font_size * (init_height/this._height);
this.setStyle("fontSize",Math.round(font_size2));

```

this however does not work as the font still stays huge.

Any ideas are appreciated.

Thanks  
Aditya

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 6, 2004, 5:51am UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/2 "2004-07-06T05:51:44Z")

</div>

how did you resize the textarea?  
if with the transform tools, remove, put a new one, and resize with property inspector only (width & height values).

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 6, 2004, 6:00am UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/3 "2004-07-06T06:00:41Z")

</div>

> [@eyezberg](#):
>
> how did you resize the textarea?  
> if with the transform tools, remove, put a new one, and resize with property inspector only (width & height values).

I think he’s resizing dynamically at runtime, eyez. 😉

I personally don’t know the solution to your problem… Is there a “rows” or “cols” property associated with the component?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 6, 2004, 2:51pm UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/4 "2004-07-06T14:51:42Z")

</div>

yeah I am resizing at runtime… as the this.\_height = something suggests. I have looked at various properties in the actionscript dictionary but couldn’t find any that helped me =( … I mean if I set a style, it should change right???

HELP :crying:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 6, 2004, 3:36pm UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/5 "2004-07-06T15:36:10Z")

</div>

Is there a specific reason you are using the text area component instead of just and dynamic textfield. The component has all the properties applied to it as though the text is a picture, thus the streching, it doesn’t apply the \_width/\_height properties to the bounding box as a regular textfield would.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 6, 2004, 3:59pm UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/6 "2004-07-06T15:59:44Z")

</div>

I am using a textarea because I need the CSS functionality… I didn’t think the regular textbox would support CSS (or images for that matter).

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 6, 2004, 7:04pm UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/7 "2004-07-06T19:04:09Z")

</div>

anyone? :-/

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 6, 2004, 8:25pm UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/8 "2004-07-06T20:25:54Z")

</div>

Hmm, can you dynamically create a Textarea component at runtime?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 6, 2004, 9:14pm UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/9 "2004-07-06T21:14:08Z")

</div>

Not sure about css I’ll have to check but I know pictures are supported…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 6, 2004, 9:47pm UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/10 "2004-07-06T21:47:16Z")

</div>

Thanks for the tip Gwing… never crossed my mind.

Flash being as awesome as it is, it does allow you to create instances of components at runtime :cool:

You just have to drop the component in your movie’s libary and do something like this:

```auto

import mx.controls.TextArea;
createClassObject(TextArea,"_message",10,{_height:200,text:"blah blah"});

```

kinda interesting… a lot of software is moving towards the whole import and packages deal… good stuff 😃

CHEERS,  
Aditya

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 7, 2004, 5:51am UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/11 "2004-07-07T05:51:04Z")

</div>

Excellent, no problem. Glad to be of help.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 7, 2004, 4:48pm UTC](https://forum.kirupa.com/t/help-with-resizing-textarea-component-text-getting-streched/56615/12 "2004-07-07T16:48:01Z")

</div>

could also try to use the textfield.autoSize feature… 😉  
works fine
