# Adding scroll bar to dynamic text field

**URL:** https://forum.kirupa.com/t/adding-scroll-bar-to-dynamic-text-field/29235
**Category:** Uncategorized
**Created:** [August 24, 2003, 5:39pm UTC](https://forum.kirupa.com/t/adding-scroll-bar-to-dynamic-text-field/29235 "2003-08-24T17:39:51Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![potamus](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@potamus](https://forum.kirupa.com/u/potamus)
#### Post date: [August 24, 2003, 5:39pm UTC](https://forum.kirupa.com/t/adding-scroll-bar-to-dynamic-text-field/29235/1 "2003-08-24T17:39:51Z")

</div>

I am using some code I found in the forum to create my custom text fields and am having trouble getting a scroll bar to show up.

MovieClip.prototype.$createTextField = MovieClip.prototype.createTextField;  
MovieClip.prototype.createTextField = function(instanceName, depth, x, y, width, height) {  
if (arguments.length\<6) {  
return undefined;  
}

```
    this.$createTextField(instanceName, depth, x, y, width, height);
    this[instanceName].defaultTextFormat();
    return this[instanceName];

```

};  
ASSetPropFlags(MovieClip.prototype, null, 1, 0);  
TextField.prototype.defaultTextFormat = function() {  
// add TextField properties here

```
	this.multiline = true;
	this.wordWrap = true;
	this.scroll = true;
	this.border = true;

	this.text = "hello world hello world hello world";

    var myTextFormat = new TextFormat();
    // add TextFormat properties here
	myTextFormat.font = "Tahoma";
	myTextFormat.color = 0x000000;
	myTextFormat.size = 10;
    this.setNewTextFormat(myTextFormat);
    this.setTextFormat(myTextFormat);

```

};  
ASSetPropFlags(TextField.prototype, null, 1, 0);

createTextField(“webMain”, 2, 200, 200, 20, 188);

so… if i give the text portion more than the box can show there is still no scroll bar in sight. Any ideas?

Thanks.

---

<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: [August 24, 2003, 6:19pm UTC](https://forum.kirupa.com/t/adding-scroll-bar-to-dynamic-text-field/29235/2 "2003-08-24T18:19:01Z")

</div>

I don’t think I understand the problem… could you attach your FLA? :-\

---

<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: [August 24, 2003, 6:28pm UTC](https://forum.kirupa.com/t/adding-scroll-bar-to-dynamic-text-field/29235/3 "2003-08-24T18:28:53Z")

</div>

I dont understand it either… as far as i know, theres no way to dinamically add a scrollbar for your textfield, unless you attach it from the library. :-\

---

<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: [August 24, 2003, 6:30pm UTC](https://forum.kirupa.com/t/adding-scroll-bar-to-dynamic-text-field/29235/4 "2003-08-24T18:30:44Z")

</div>

Kax,  
Problem is there is no scroll bar as you will see. Here is the .fla, thanks a lot.

Potamus

---

<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: [August 24, 2003, 6:44pm UTC](https://forum.kirupa.com/t/adding-scroll-bar-to-dynamic-text-field/29235/5 "2003-08-24T18:44:45Z")

</div>

Do you think that setting the scroll property to true, the scrollbar will show up? Well, the answer is no. The scroll property sets the vertical position of the text in the TextField.

This is what I think you want to do, see attachment. 😉

---

<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: [August 24, 2003, 7:02pm UTC](https://forum.kirupa.com/t/adding-scroll-bar-to-dynamic-text-field/29235/6 "2003-08-24T19:02:50Z")

</div>

Once again you have answered my question perfectly kax, thanks a lot.

potamus

---

<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: [August 24, 2003, 7:03pm UTC](https://forum.kirupa.com/t/adding-scroll-bar-to-dynamic-text-field/29235/7 "2003-08-24T19:03:39Z")

</div>

You’re welcome, potamus. =)
