ForumsProgramming ForumHelp with for each command!

1 2774
Fighterlegend
offline
Fighterlegend
44 posts
Nomad

function Parseuser(userXML:XML):void {
var userList:XMLList = userXML.report.item.title;
var userData:XMLList = userXML.report.item.reason;
trace('got';
for each (var userTitle:XML in userList && var userReason:XML in userData) {
my_lst.addItem({label:userTitle, data:userReason});
trace(userDat);
}
}

is my script..


The part that doesn't work:

for each (var userTitle:XML in userList && var userReason:XML in userData) {

I'm wondering how to fix this..




ERRORS:
[quote="1083: Syntax error: var is unexpected."]for each (var userTitle:XML in userList && var userReason:XML in userData) {[/quote]
[quote="1084: Syntax error: expecting rightparen before leftbrace."]for each (var userTitle:XML in userList && var userReason:XML in userData) {[/quote]



If the quotes don't work, then here's the text:

1083: Syntax error: var is unexpected.
for each (var userTitle:XML in userList && var userReason:XML in userData) {

1084: Syntax error: expecting rightparen before leftbrace.
for each (var userTitle:XML in userList && var userReason:XML in userData) {




Please, help!

-Fighterlegend

  • 1 Reply
Fighterlegend
offline
Fighterlegend
44 posts
Nomad

function Parseuser(userXML:XML):void {
var userList:XMLList = userXML.report.item;
trace('got';
for each (var userTitle:XML in userList) {
my_lst.addItem({label:userTitle.title, data:userTitle.reason});
trace(userTitle.reason);
}
}


Don't need it!

Got the code fixed up and ready! You could delete this thread now..

Showing 1-1 of 1