Prototype: Array.findnumber [Flash 8]
| Beiträge: 0 Registriert: Feb 2009
| 01.03.2009, 12:47
Prototype, um die Indexzahl eines Wertes zu erhalten
Prototype:
ActionScript:1 2 3 4 5 6 7 8 | Array.prototype.findnumber = function(eingabe) {
for (i=0; i<=this.length; i++) {
trace(this[i]);
if (eingabe == this[i]) {
return i;
}
}
};
|
Beispiel Aufruf:
ActionScript:1 2 3 | Beispiel = ["Wert1", "Wert2", "Wert3", "Wert4"];
trace(Beispiel.findnumber("Wert4"));
// Es wird 3 ausgegeben
|
| |
| Ähnliche Beiträge zum Thema | |
|
Flashhilfe.de Flash Platform Tipps & Tutorials Flash Platform Andere Programmiersprachen Jobangebote Diskussionen
Flashhilfe News
Regeln & Bedingungen
|