In the below code, indexOf()
is always returning -1
. The array being searched definately has the values within.
We've tried converting the checked integer into a string in case the array has string formats within, no luck there either.
If anybody could shed any light that would be great!
AS3
var c:int = 0;
var storedCachesShared:SharedObject = SharedObject.getLocal("cacheStore");
var storedCaches:Array = storedCachesShared.data.cacheArray;
trace(storedCaches); // 1, 2
trace(storedCaches.indexOf(c+1)); // Always returns -1
if(storedCaches.indexOf(c+1) < 0){
storedCaches.push([c+1]);
storedCachesShared.flush();
}
Many thanks, Nick