Thursday, 18 March 2010

Consuming WebServices ASP.NET c# - Flex 4

I found this to be infuriating!!!

As the new Flash Builder does so much for you with the Data->Connect to WebServices command, it was bound to get difficult.

Once you have successfully connected to a webservice this way. To consume via AS3 is as follows.

var theVotingService:VotingService = new VotingService();
theVotingService.addEventListener(ResultEvent.RESULT, getLiveQuestion_result);
theVotingService.getLiveQuestion();

then add a listener for the result:

private function getLiveQuestion_result(e:ResultEvent):void{
lblService.text = e.result.toString();
}

These wizards make life easier, soemtimes too easy once you go off the path its difficult.

Post a comment if you would like any further help/examples.

No comments:

Post a Comment