We Recommend

CSS: The Definitive Guide CSS: The Definitive Guide
Provides you with a comprehensive guide to CSS implementation, along with a thorough review of all aspects of CSS 2.1. Updated to cover Internet Explorer 7, Microsoft's vastly improved browser, this new edition includes content on positioning, text wrapping (nowrap), lists and generated content, table layout, user interface, paged media, and more.


Posted By

wintondeshong on 08/26/07


Tagged

textmate actionscript array xml filter associative


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

n00ge


filterXMLAssocArray


Published in: ActionScript 


  1. // Filters specified tags from a supplied XML Node resource by tag name.
  2. // Returns a new associative array with the filtered tags' attributes.
  3. private function filterXMLAssocArray(filterNodeName:String, xmlNodes:Array):Array{
  4.  
  5. var tmpArray:Array = new Array();
  6.  
  7. var indexCounter:Number = 0;
  8. for (var i:Number = 0; i<xmlNodes.length; i++){
  9. if (xmlNodes[i].nodeName == filterNodeName){
  10. tmpArray[indexCounter] = new Array();
  11. tmpArray[indexCounter] = xmlNodes[i].attributes;
  12. indexCounter ++;
  13. }
  14. }
  15. return tmpArray;
  16. };

Report this snippet 

You need to login to post a comment.