Yes, you should be setting a result handler for the web service operation, and showing your alert on result or fault.

Your code will not work on the first click because the web service has not returned by the time you display the alert.

Karl

Karl Johnson
Cynergy Systems, Inc.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of vestcomprogrammer
Sent: Monday, May 08, 2006 2:54 PM
To: [email protected]
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"/ >     






------------------------ Yahoo! Groups Sponsor --------------------~--> You can search right from your browser? It¿s easy and it¿s free.  See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->

--
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