{lang: 'de'}
Flashhilfe.de - Flash Community

Prototype: Foreach [Flash 8]

 


AntwortenRegistrieren Seite1  

burnZ#1
Benutzerbild von burnZ
Beiträge: 2827
Wohnort: Bayern
Registriert: Aug 2005

13.06.2007, 13:23

Auf jedes Item ein Callback Anwenden

Prototype:
ActionScript:
1
2
3
4
Array.prototype.foreach = function( callback:Function )
{
   for( var index:String in this ) callback( index, this[ index ] );
}


Beispiel Aufruf:
ActionScript:
1
2
3
4
5
6
7
8
var myArray:Array = [ { name:'Hans', id:1 }, { name:'Wurst', id:2 } ];

function traceIt( index:String, item:Object ):Void
{
    trace( item.name + '/' + item.id );
}

myArray.foreach( traceIt );

Schlagwörter: asbroadcaster, prototype

AntwortenRegistrieren Seite1  

Schnellantwort

Du musst registriert sein, um diese Funktion nutzen zu können.

 
Ähnliche Beiträge zum Thema
Partner Webseiten: art-and-law.de  Mediengestalter.info   phpwelt.de   Scubacube.de  
Haftungsausschluss   Datenschutzerklärung   Impressum
© 1999-2024 Sebastian Wichmann - Flashhilfe.de