0 Replies Latest reply on Apr 25, 2007 8:08 AM by Atmospherian

    accessing web service last result from click handler

    Atmospherian
      im using the following basic setup:

      <mx:WebService id="ws" wsdl=" http://10.0.55.167:8080/DesignStudio/services/Test?wsdl">
      <mx:operation name="AuthenticateUser"/>
      </mx:WebService>

      <mx:Script>
      <![CDATA[
      import flash.events.MouseEvent;
      import mx.controls.Alert;


      private function loginButtonClickHandler(event: MouseEvent):void
      {
      var result:String = "";

      //Alert.show(username.text + " " + password.text);
      ws.AuthenticateUser(username.text, password.text);

      if (ws.AuthenticateUser.lastResult == "authenticated") {
      Alert.show("woohoo!");
      }
      }
      ]]>
      </mx:Script>

      <mx:TextInput x="108" y="363" id="username"/>
      <mx:TextInput x="108" y="401" id="password" displayAsPassword="true"/>
      <mx:Button x="108" y="438" label="Button" id="login" click="loginButtonClickHandler(event);"/>
      <mx:Label x="108" y="485" text="{ws.AuthenticateUser.lastResult}" id="resulttxt" color="#ffffff"/>


      the alert box in the click handler is only fired after the second time i click the button. what do i need to do to ensure that it would fire on the first click?

      this is just a test for a much more complicated process that would ensue once the user is authenticated, but i just want to get the basic functionality working. thanks