Removing selective data from a variable

You can store the variables in an array and remove them from the array when needed. For example…

[AS]myArray = [“var1”, “var2”, “var3”, “var4”, “var5”];
Array.prototype.removeItem = function(pos) {
this.splice(pos, 1);
trace(this);
};
myArray.removeItem(3);[/AS]

(since arrays start counting at 0 this will remove “var4”)

[edit]if it would be easier on you you could do this… [AS]myArray = [“var1”, “var2”, “var3”, “var4”, “var5”];
Array.prototype.removeItem = function(pos) {
this.splice(pos-1, 1);
trace(this);
};
myArray.removeItem(3);[/AS] And that way YOU don’t have to count from 0 and removeItem(3) will actually remove “var3” [/edit]