Removing selective data from a variable

As far as I know, I don’t even have an Array yet. I only created a variable on the main timeline… but the buttons all need individual code of some sort to send their value to the variable.

How do I change the variable into an Array? Maybe I’m not on the right track so I’ll try and break things down so you can explain it to me in laymans terms.

  1. I’m guessing that all of the code you sent me goes on each button?

  2. The variable on the main timeline is called ‘_root.sampleselect’. Does that stay as is and just automatically become my Array? Or do I have to change something?

  3. Now to the code: (1st part)

on (press){
_root.myArray.push(“colour1”);
}

Do I replace the myArray part with _root.sampleselect.push(“colour1”) ?

  1. next part:

myArray = [“colour1”, “colour2”, “colour3”, “colour4”, “colour5”];
Array.prototype.removeItem = function(pos) {
this.splice(pos-1, 1);
return this;
};


Should the code above read like this: (I’m just taking a wild guess, probably am wrong. What other parts need customising? Do I need to change the words ‘prototype’, ‘function’, ‘splice’ to anything personalised?

_root.sampleselect = [“colour1”, “colour2”, “colour3”, “colour4”, “colour5”];
_root.sampleselect.prototype.removeItem = function(pos) {
this.splice(pos-1, 1);
return this;
};


  1. last part

myArray.removeItem(3);
for (var i = 0; i myString += myArray*+"
";
}
trace(myString);


Do I change the myArray parts and myString parts to particular variable names?


  1. Basically, I don’t understand what to put where…

Hope you can help.

Sorry, for my difficulty in learning.

the chad