/ Published in: ActionScript 3
Based upon another snippet from this site, but can't remember where i got it
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private function isNewInArray(value:Object, arr:Array):Boolean { for (var i:uint=0; i < arr.length; i++) { if (arr[i]==value) { return false; } } return true; } if(isNewInArray(foo, barArray)) { barArray.push(foo); } else { trace("Item already in array"); }