With E4X you don't necessarily need to loop through nodes to find specific nodes. You could think of E4X as a search tool for your ndoes. Example:
<addressbook>
<contact>
<name/>
<address/>
<phone/>
<phone/>
</contact>
</addressbook>
So to find all phone nodes, you don't need to loop through the contents of the contacts node. Instead you can ask for all the phone nodes with E4X:
var allPhoneNodes:XMLLIst = myXML.contacts.phone;
You'll get an XMLList with the two phone nodes. If you want to put each phone node into a separate variable, then you could loop through that XMLList just like you would loop through an array, but without the need to test against each node name.