нужно иметь дублированный значение из массива и получить код ниже, работает хорошо, но в AS3Actionscript: Преобразование функции из AS3 в AS2
Пожалуйста, может кто-то преобразовать этот AS3 код AS2? Код
var array:Array = [1,2,3,4,3];
// create a dictionary and go through our array, pulling out the values
var dict:Dictionary = new Dictionary();
var len:int = array.length;
for(var i:int = 0; i < len; i++)
{
var val:int = array[i]; // get the value from the array
if(!(val in dict)) // if it's not in our dictionary, create a new array
dict[val] = [];
dict[val].push(i); // add the index of the value to the array
}
// now go through our dictionary, finding the duplications
for(var key:* in dict)
{
var indicies:Array = dict[key];
if(indicies.length <= 1)
continue; // single value - ignore
trace("The value " + key + " is repeated " + indicies.length + " times. Indicies: " + indicies);
}
ошибки:
Sequence = ПОСЛЕДОВАТЕЛЬНОСТЬ 1, слой = калька 1, рамка = 1, 2 Ligne невыполним де ли зарядное устройство Classe НУ l'интерфейс 'Словарь'.
Séquence = Séquence 1, layer = Calque 1, frame = 1, ligne 3 Невозможное зарядное устройство la classe ou l'interface 'int'.
Séquence = Séquence 1, layer = Calque 1, frame = 1, ligne 4 Невозможное зарядное устройство la classe ou l'interface 'int'.
Séquence = Séquence 1, layer = Calque 1, frame = 1, ligne 6 Невозможное зарядное устройство la classe ou l'interface 'int'.
Sequence = ПОСЛЕДОВАТЕЛЬНОСТЬ 1, слой = калька 1, рамка = 1, Ligne 7 ')' attendu
- Sequence = ПОСЛЕДОВАТЕЛЬНОСТЬ 1, слой = калька 1, рамка = 1, Ligne 10 '}' inattendu
Да, ошибка находится в главном сообщении –