I'm building an AS cache for SCORM data that stores info in a multidimensional array: [element name][element value].
The normal method to search this would be something like this:
code:
for (var i:Number=0; i<array.length; i++) {
if (array[i][0] == "someelementname") {
return array[i];
break;
}
}
Q1: Is there a faster / more efficient way to search the array?
Q2: If I'm going to add a 3rd property, a bit indicating whether or not the cache element has been committed back to the LMS or not, am I better off creating a class of objects or classes (e.g. write a cmi data element class: array[1] = new DataElement(score,200,0)), rather than using a multidimensional array?
The goal of this is to be efficient to eliminate lag between requesting data from the SCORM API and to prevent multiple SCORM API calls from being fired in a row by a developer, because ExternalInterface occasionally hiccups if that happens.
