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.
-
I’m guessing that all of the code you sent me goes on each button?
-
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?
-
Now to the code: (1st part)
on (press){
_root.myArray.push(“colour1”);
}
Do I replace the myArray part with _root.sampleselect.push(“colour1”) ?
- 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;
};
- 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?
- Basically, I don’t understand what to put where…
Hope you can help.
Sorry, for my difficulty in learning.
the chad