# For each in loop EX4 and Actionscript 3

**URL:** <https://forum.kirupa.com/t/for-each-in-loop-ex4-and-actionscript-3/250063>\
**Category:** flash\
**Created:** [January 25, 2008, 1:37am UTC](https://forum.kirupa.com/t/for-each-in-loop-ex4-and-actionscript-3/250063 "2008-01-25T01:37:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anibus](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@Anibus](https://forum.kirupa.com/u/Anibus)\
**Post date:** [January 25, 2008, 1:37am UTC](https://forum.kirupa.com/t/for-each-in-loop-ex4-and-actionscript-3/250063/1 "2008-01-25T01:37:46Z")

</div>

**[FONT=Courier New][COLOR=#0033ff]Yo Pro’s,[/COLOR][/FONT]**  
**[FONT=Courier New][COLOR=#0033ff]…[/COLOR][/FONT]**

**[COLOR=#0033ff][FONT=Courier New]for [/FONT][/COLOR]\*\*\*\*[COLOR=#0033ff][FONT=Courier New]each[/FONT][/COLOR]**[COLOR=black][FONT=Courier New] ([/FONT][/COLOR]**[COLOR=#6699cc][FONT=Courier New]var[/FONT][/COLOR]**[COLOR=black][FONT=Courier New] property:XML [/FONT][/COLOR]**[COLOR=#0033ff][FONT=Courier New]in[/FONT][/COLOR]**[COLOR=black][FONT=Courier New] getPaid.revenue.(hasOwnProperty([/FONT][/COLOR]**[COLOR=#990000][FONT=Courier New]‘revTitle’[/FONT][/COLOR]**[COLOR=black][FONT=Courier New])[/FONT][/COLOR]  
[COLOR=black][FONT=Courier New]&& revTitle == [/FONT][/COLOR]**[COLOR=#990000][FONT=Courier New]‘Sister Love’[/FONT][/COLOR]**[COLOR=black][FONT=Courier New]))[/FONT][/COLOR]  
[FONT=Arial][SIZE=3]Works ……but[/SIZE][/FONT]

[FONT=Arial][SIZE=3]I need to test for two elements…. So, I attempted the following[/SIZE][/FONT]

_[COLOR=#009900][FONT=Courier New]for each (var property:XML in getPaid.revenue.(elements(‘revTitle’) == ‘The Money’)[/FONT][/COLOR]_  
_[COLOR=#009900][FONT=Courier New]&& (var property:XML in getPaid.revenue.(elements(‘revType’) == ‘Performance’))[/FONT][/COLOR]_

[FONT=Arial][SIZE=3]It doesn’t work and the error message is “the second element is not well formed”[/SIZE][/FONT]

[FONT=Arial][SIZE=3]Does anyone have the correct syntax ?[/SIZE][/FONT]

Sincerely,  
Anibus

XML File…  
[FONT=Courier New]\<?xml version=“1.0” encoding=“UTF-8”?\> [/FONT]

[FONT=Courier New]\<revData\>[/FONT]  
[FONT=Courier New]\<revenue\>[/FONT]  
[FONT=Courier New]\<revName\>KJAZZ\</revName\>[/FONT]  
[FONT=Courier New]\<revTitle\>Sister Love\</revTitle\>[/FONT]  
[FONT=Courier New]\<revAmount\>4,000.00\</revAmount\>[/FONT]  
[FONT=Courier New]\<revDateIn\>[/FONT][FONT=Courier New]12/20/1990[/FONT][FONT=Courier New]\</revDateIn\>[/FONT]  
[FONT=Courier New]\<revDateOut\>[/FONT][FONT=Courier New]12/20/2009[/FONT][FONT=Courier New]\</revDateOut\>[/FONT]  
[FONT=Courier New]\<revType\>Performance\</revType\>[/FONT]  
[FONT=Courier New]\<revDescript\>Radio Play\</revDescript\>[/FONT]  
[FONT=Courier New]\</revenue\>[/FONT]

[FONT=Courier New]\</revData\>;[/FONT]
