# How to allocate dyn. text to several textfields?

**URL:** <https://forum.kirupa.com/t/how-to-allocate-dyn-text-to-several-textfields/259869>\
**Category:** Uncategorized\
**Created:** [May 9, 2008, 2:57pm UTC](https://forum.kirupa.com/t/how-to-allocate-dyn-text-to-several-textfields/259869 "2008-05-09T14:57:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![keitai](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@keitai](https://forum.kirupa.com/u/keitai)\
**Post date:** [May 9, 2008, 2:57pm UTC](https://forum.kirupa.com/t/how-to-allocate-dyn-text-to-several-textfields/259869/1 "2008-05-09T14:57:37Z")

</div>

Hi all,

I was wondering how i can prevent a scrollbar, so i was thinking about allocating the text to several dyn. textfield (depending on the size of the text)

Any tips advice??

---

<div class="post-metadata">

**Author:** ![keitai](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@keitai](https://forum.kirupa.com/u/keitai)\
**Post date:** [May 9, 2008, 3:49pm UTC](https://forum.kirupa.com/t/how-to-allocate-dyn-text-to-several-textfields/259869/2 "2008-05-09T15:49:04Z")

</div>

ok now i got this, not flexible yet and i got to split the text

```auto

 function displayDynText(pText:String, pTextFieldName:TextField, pTextFieldH:Number) {
	var pTextFieldName:TextField = createTextField(pTextFieldName, this.getNextHighestDepth(), 0,0, 340, pTextFieldH);
	pTextFieldName.multiline = true;
	pTextFieldName.wordWrap = true;
	//pTextFieldName.autoSize = "left";
	pTextFieldName.text = pText;
	if(pTextFieldName.textHeight > pTextFieldH) {
		var pTextFieldName1:TextField = createTextField(pTextFieldName, this.getNextHighestDepth(), 0,0+pTextFieldH, 340, pTextFieldH);
		pTextFieldName1.multiline = true;
		pTextFieldName1.wordWrap = true;
		//pTextFieldName.autoSize = "left";
		pTextFieldName1.text = pText;
	}
 }
 
 pText = "It has been a couple of years since I wrote about converting a disc hub to fixed gear, and the following might be considered a sequel to my original article.One of the problems in converting a gearie to a fix is that you won't easily find a big cog to match the outer chainring. This leads fixers to opt for a singlespeed-style 36:18 or similar setup, which means buying an expensive new cog and chainring. What a waste! They'd get more wear and less chainlaunch with a 44:22 setup based on their existing big ring.A year or two ago I was looking at my vast collection of unused 22t granny rings when I suddenly realised: hey, these would make good fixed gear cogs! Immediately I thought of machining adaptor plates to allow me to bolt the rings with their different bolt patterns to a standard six-bolt disc hub. Knowing the way my mind works, I waited for the revision that would make it accessible to the average bike tinkerer. A couple of months later my backbrain sent me the postscript I wanted. The beauty of the idea lay in its use of symmetry.";

 displayDynText(pText, pageContent, 200);

```

---

<div class="post-metadata">

**Author:** ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)\
**Post date:** [May 9, 2008, 8:46pm UTC](https://forum.kirupa.com/t/how-to-allocate-dyn-text-to-several-textfields/259869/3 "2008-05-09T20:46:50Z")

</div>

> **[Need Help With Multi Column Text](https://www.kirupa.com/forum/showthread.php?t=296019)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

---

<div class="post-metadata">

**Author:** ![keitai](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@keitai](https://forum.kirupa.com/u/keitai)\
**Post date:** [May 13, 2008, 8:06am UTC](https://forum.kirupa.com/t/how-to-allocate-dyn-text-to-several-textfields/259869/4 "2008-05-13T08:06:07Z")

</div>

tx glosrfc,

It almost works like i want it too. The problem i have is, i want to have it dynamicly. And i can’t see how the text is being divided in your script.

At the moment i am playing with this

```auto

var txtArray:Array; // to hold text if it's larger

function displayDynText(pText:String, pTextFieldName_txt:TextField, pTextFieldH:Number) {
	var pTextFieldName_txt:TextField = createTextField(pTextFieldName_txt, this.getNextHighestDepth(), 0, 0, 340, pTextFieldH);
	pTextFieldName_txt.multiline = true;
	pTextFieldName_txt.wordWrap = true;
	pTextFieldName_txt.text = pText;
	//if text is larger than textfield
	if (pTextFieldName_txt.maxscroll != 1) {
		//we need to create another textfield(s) dynamicly
//so 1 becomes var i
		var pTextFieldName_txt1:TextField = createTextField(pTextFieldName_txt, this.getNextHighestDepth(), 0, 50+pTextFieldH, 340, pTextFieldH);
		pTextFieldName_txt1.multiline = true;
		pTextFieldName_txt1.wordWrap = true;
		pTextFieldName_txt1.text = pTextFieldName_txt.text;
		trace(pTextFieldName_txt.bottomScroll);
		
		for (i=0; i<pTextFieldName_txt.bottomScroll; i++) {
			trace(i);
			pTextFieldName_txt1.text += "
";
		}
		pTextFieldName_txt1.scroll = pTextFieldName_txt.bottomScroll+1;
		//we need to dynamicly create a button per textfield
		//for (var i=1; i < ??? ; i++) { 
		var page1:MovieClip = this.attachMovie('pageNumbers', 'page1', this.getNextHighestDepth()); 
		page1.pageNr.text = 1;
		page1._x = pTextFieldName_txt._width - 50;
		page1._y = pTextFieldName_txt._height + 5;
		page1.onRelease = function() {
			//load the text
			trace("Page 1");
		};
	}
}

//usage
displayDynText(pText, pageContent, 200);

```

Can i store the seperated text in an array? Or how should i do it?
