Array question (simpler than last)

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!

What’s with the ‘set’ ?


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

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?

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 ?

exactly!

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?

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:


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 ! :wink:

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