Revision: 43948
Updated Code
at April 4, 2011 04:47 by withinmedianl
Updated Code
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"); }
Revision: 43947
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 4, 2011 04:46 by withinmedianl
Initial Code
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"); }
Initial URL
Initial Description
Based upon another snippet from this site, but can't remember where i got it
Initial Title
Check if item is not already in an Array
Initial Tags
Initial Language
ActionScript 3