WebService calls are asynchronous...

[NotTested]:

<mx:Script>
<![CDATA[
  public function GetHelloWorld():void     
  {
   CustomerServices.HelloWorldws.addEventListener("result",
HelloWorldwsResult);
   CustomerServices.HelloWorldws.send ();
  }
  public function HelloWorldwsResult(event:ResultEvent):void     
  {
   CustomerServices.HelloWorldws.removeEventListener("result",
HelloWorldwsResult);
   temp =  CustomerServices.HelloWorld.result;
   mx.controls.Alert.show(temp);
  }
]]>
</mx:Script>

<mx:WebService
wsdl="http://localhost/Flex2T_WebServiceTest/Service1.asmx?wsdl
id="CustomerServices"
fault="mx.controls.Alert.show(event.fault.faultstring)"
>
</mx:WebService>
     
<mx:Button click="this.GetHelloWorld();" label="Push Me"/ >     


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of vestcomprogrammer
Sent: Monday, May 08, 2006 2:54 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] WebService Flex 2.0

I have the follwing code and I have to click on the button twice to
get the value that the web services send back.  Is there a way to
fix this problem?



<mx:Script>
<![CDATA[
  public function GetHelloWorld():void     
  {
   CustomerServices.HelloWorld.send();           
   temp =  CustomerServices.HelloWorld.result;
   mx.controls.Alert.show(temp);
  }
]]>
</mx:Script>

<mx:WebService
wsdl="http://localhost/Flex2T_WebServiceTest/Service1.asmx?wsdl
id="CustomerServices"
fault="mx.controls.Alert.show(event.fault.faultstring)"
>
</mx:WebService>
     
<mx:Button click="this.GetHelloWorld();" label="Push Me"/ >     







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links













--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to