Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / October 2005



Tip: Looking for answers? Try searching our database.

Web service question...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
C-Rock - 31 Oct 2005 18:31 GMT
I'm calling a web service that returns an array. I have a function that just
displays the result returned. I'm getting [object, object] when I trace the
result. How do I pull a variable returned from the array like city? I've tried;

details.onResult=function(result){
      trace(result.city); // equals undefined
      trace(result); // equals [object, object]
}
please help;
what am i missing
Kaare - 31 Oct 2005 18:48 GMT
You have to parse through the array, which per default does not have named
indexes. It goes something like this:

details.onResult=function(result){
    for(var i=0; i<result.length;i++){
        trace("result["+i+"] = "+result);
    }
}
C-Rock - 31 Oct 2005 19:37 GMT
I'm still getting object object... Here's what my trace says.

result[0]=[object Object]

any ideas???
Kaare - 31 Oct 2005 20:32 GMT
That would make sense if what's in the first index of the array is another
array, which could have been traced like this: trace("result[0][0] =
"+result[0][0]);

But I just saw an error, so it actually makes sense it outputs [object] again.

Revised script:
details.onResult=function(result){
for(var i=0; i<result.length;i++){
trace("result["+i+"] = "+result);
}
}
C-Rock - 31 Oct 2005 20:35 GMT
cool!!! thanks man!!!
C-Rock - 31 Oct 2005 20:35 GMT
cool!!! thanks man!!!
Kaare - 31 Oct 2005 20:35 GMT
Sorry 'bout that by the way ;)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.