# createTextField

**URL:** <https://forum.kirupa.com/t/createtextfield/62289>\
**Category:** Uncategorized\
**Created:** [August 26, 2004, 3:21pm UTC](https://forum.kirupa.com/t/createtextfield/62289 "2004-08-26T15:21:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SePP](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@SePP](https://forum.kirupa.com/u/SePP)\
**Post date:** [August 26, 2004, 3:21pm UTC](https://forum.kirupa.com/t/createtextfield/62289/1 "2004-08-26T15:21:44Z")

</div>

I tried everything, it works perfectly without the loop but when I try to put it in a loop it displays nothing.  
I figured out it has something to do with the naming of mytext, It seems it needs to be quoted ☹ I colored red where I think the fault is.

```auto

xwaarde = 20;
for(i=0;i<3;i++){
mytext = "mytext"+i;
_root.createTextField([COLOR=Red]mytext[/COLOR], i, xwaarde, 100, 50, 100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
mytext.text = "this is my first test field object text";
xwaarde = xwaarde+80;
}

```

the following works perfectly :

```auto

xwaarde = 20;
_root.createTextField("mytext", 0, xwaarde, 100, 50, 100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
mytext.text = "this is my first test field object text";

```

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 26, 2004, 5:03pm UTC](https://forum.kirupa.com/t/createtextfield/62289/2 "2004-08-26T17:03:02Z")

</div>

mytext.multiline = true; - this is addresing a “mytext” movie not “mytext”+i as you supposed.  
Try using “with” … something like this.

```auto

xwaarde = 20;
for(i=0;i<3;i++){
mytext = "mytext"+i;
_root.createTextField(mytext, i, xwaarde, 100, 50, 100);
with ("mytext"+i){
multiline = true;
wordWrap = true;
border = true;
text = "this is my first test field object text";}
xwaarde = xwaarde+80;
}

```

Hope it works  
Later Edit:  
Actually a “with(mytext)” statement should work also  
I believe it should work. I don’t have flash here and haven’t tested 🙂  
Let me know if works

---

<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 26, 2004, 5:25pm UTC](https://forum.kirupa.com/t/createtextfield/62289/3 "2004-08-26T17:25:33Z")

</div>

nah… because _mytext_ is a variable, hence the name of your text field depends upon a variable, you need to address it as such:

```auto
_root[mytext]

```

before each of your textfields properties will do the trick…

eg.

```auto
xwaarde = 20;
for(i=0;i<3;i++){
mytext = "mytext"+i;
_root.createTextField(mytext, i, xwaarde, 100, 50, 100);
_root[mytext].multiline = true;
_root[mytext].wordWrap = true;
_root[mytext].border = true;
_root[mytext].text = "this is my first test field object text";
xwaarde = xwaarde+80;
}

```

should work wivout a prob 😉

Prophet.

---

<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 27, 2004, 9:15am UTC](https://forum.kirupa.com/t/createtextfield/62289/4 "2004-08-27T09:15:06Z")

</div>

is there something worng with the **“with”** statement?  
I mean i used it that way when I had this problem… but maybe is this deprecated or something? Or is only a reason of habit?

_Later Edit…_ My first post was indeed wrong but i told you I could be missing something :P. Forgoted the **“eval”**

```auto
with (eval(mytext))
{
text = "value";
}

```

---

<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 27, 2004, 1:06pm UTC](https://forum.kirupa.com/t/createtextfield/62289/5 "2004-08-27T13:06:00Z")

</div>

thanks for the help guys
