# Array question (simpler than last)

**URL:** <https://forum.kirupa.com/t/array-question-simpler-than-last/106718>\
**Category:** Uncategorized\
**Created:** [April 8, 2004, 6:36am UTC](https://forum.kirupa.com/t/array-question-simpler-than-last/106718 "2004-04-08T06:36:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![WarpSpider](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@WarpSpider](https://forum.kirupa.com/u/WarpSpider)\
**Post date:** [April 8, 2004, 6:36am UTC](https://forum.kirupa.com/t/array-question-simpler-than-last/106718/1 "2004-04-08T06:36:07Z")

</div>

Ok, my array name needs to be a variable. Possible? Like, can my variable be called **myArrayName** and my array code look like this:

**set (myArrayName, null)**  
**myArrayName = [null, null, null, null]**

I’d like to have buttons set each value. So the nulls are necessary as initial values to just get it created? Please 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:** [April 8, 2004, 6:45am UTC](https://forum.kirupa.com/t/array-question-simpler-than-last/106718/2 "2004-04-08T06:45:01Z")

</div>

What’s with the ‘set’ ?

```auto

myArrayName = new Array(4);
myArrayName[1] = "someValue";
trace(myArrayName)

```

---

<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:** [April 8, 2004, 8:10am UTC](https://forum.kirupa.com/t/array-question-simpler-than-last/106718/3 "2004-04-08T08:10:39Z")

</div>

oh man, almost lost hope, haha, but not exactly what I was lookin for. The set part is for the variable. See, myArrayName has gotta be a variable that an Input box assigns a value to.

So user types their name into input box, in turn:  
myArrayName = Bobby  
Then in the array, it calls for

myArrayName = [value,value,value]

so that it actually ends up being

Bobby = [value,value,value]

after all the buttons are said and done.

Sorry I wasnt clearer =D So is this even possible?

---

<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:** [April 8, 2004, 8:40am UTC](https://forum.kirupa.com/t/array-question-simpler-than-last/106718/4 "2004-04-08T08:40:07Z")

</div>

So you want to make a variable that is named whatever the user inputted in the input field ? Like if I’d input “Voetsjoeba” in the input field, then you want to create an array called Voetsjoeba with 4 entries ?

---

<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:** [April 8, 2004, 9:26am UTC](https://forum.kirupa.com/t/array-question-simpler-than-last/106718/5 "2004-04-08T09:26:14Z")

</div>

exactly!

---

<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:** [April 8, 2004, 9:45am UTC](https://forum.kirupa.com/t/array-question-simpler-than-last/106718/6 "2004-04-08T09:45:26Z")

</div>

And while I have your attention, lol, I got another really quick (/me really tired)

the output window keeps telling me that line 51 needs a semicolon, but line 51 says this:

51 \_root.Graph\_mc.AllWrong+1User\_btn.onRelease = function() {  
52 ++AllWrongUser;  
53 }

whats the deal? Did I mess that all up?

---

<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:** [April 8, 2004, 10:08am UTC](https://forum.kirupa.com/t/array-question-simpler-than-last/106718/7 "2004-04-08T10:08:48Z")

</div>

I tested this code, and it works perfectly … I have an input textfield on stage with the instance name ‘inputField’, and a button underneath it with the instance name ‘btn’ to press when you want the variable to be created. Place this code on the main timeline:

```auto

btn.onRelease = function(){
	set(inputField.text,new Array(4))
	trace(Voetsjoeba)
}

```

Now input the text ‘Voetsjoeba’ in the input field, press the button and voila, there’s you’re empty array called Voetsjoeba ! 😉

Oh, and I’m pretty sure that that + after AllWrong is messing it up.
