im trying to return a string value from a method inside my script tag however it always returns an object and i cant get at the string value.
Here is the code:
i retrieve the object returned from a webservice call;;
private function getNameResults(e:ResultEvent):String{ var name:Array = new Array(e.result); var site:String = site_names[0].toString(); Alert.show('site - ' +site); return site; }
the alert prints out the name fine, however when i try use the value in my next method (which calls the web service which calls getNameResults) i get the object tag
private function getInfo(roomName:String):String{ var site:String =userRequest.getRoomZoneInfo(roomName); return site; }
however the value returned here is [object AsyncToken]
any ideas?
You are setting the result of
getRoomZoneInfo()to the variable site, but you are casting it as a String.getRoomZoneInfois returning an object, and because the variable you are sticking it in is a string it is like calling.toString()on the object, which yields the [objectAsyncToken].Basically if
getRoomZoneInfois a webservice call, you cannot get the information you are looking for here, you have to wait until the result comes back and get the string you are looking for there. Make sense?