1&1 Webhosting
Flashhilfe.de - Flash Community

Prototype: Array.lastIndexOf() [Flash 8]

Forum > Tipps & Tricks zu Flash, Flex und Adobe AIR > Prototype: Array.lastIndexOf()

 


AntwortenRegistrieren Seite1  

 18.07.2003, 11:05 
Benutzerbild von Kai Jansen
Beiträge: 3099
Wohnort: Saarbrücken
Registriert: Jan 2002

Prototype: Array.lastIndexOf()
Gibt den letzten vorkommenden Index aus einem Array zurück.

Prototype:
ActionScript:
1
2
3
4
5
6
7
8
9
10
11
12
Array.prototype.lastIndexOf = function (s) {
   var index = -1;
   for (var i in this) {
      if (this[i] == s) {
         index = i;
         break;
      }
   }
   index = (isNaN(index)) ? index : Number(index);
   return index;
}
ASSetPropFlags(Array.prototype, "lastIndexOf", 7);


Beispiel Aufruf:
ActionScript:
1
2
3
4
5
6
7
8
9
num_array = [1,2,3,1];
str_array = new Array ();
str_array["a"] = 1;
str_array["b"] = 2;
str_array["c"] = 3;
str_array["d"] = 1;

trace (num_array.lastIndexOf(1) add " = " add typeof(num_array.lastIndexOf(1)));
trace (str_array.lastIndexOf(1) add " = " add typeof(str_array.lastIndexOf(1)));

MfG

Kai Jansen
Flashhilfe-Moderator

http://www.flashhilfe.de
http://www.kaijansen.de

Die Zukunft ist die Vergangenheit von Übermorgen.
Schlagwörter: Array, prototype
 
Themen
Ähnliche Beiträge zum Thema
XML in Array konvertieren [Flash 9] 20.07.2009 - regsnerven
 

AntwortenRegistrieren Seite1  

Schnellantwort

Du musst registriert sein, um diese Funktion nutzen zu können.
Partner Webseiten: DesignerInAction.de   Designnation.de   Mediengestalter.info   php-resource.de   phpforum.de   phpwelt.de   Pixelio.de   PSD-Tutorials.de   Tutorials.de

Haftungsausschluss   Datenschutzerklärung   Hier Werben   Impressum
© 1999-2012 Sebastian Wichmann - Flashhilfe.de