1 Reply Latest reply on Aug 21, 2010 2:54 PM by Flex harUI

    web service issue from flex - data sent not up to date




      I've mocked up a text input control so when you press a key it transmits the text in the control back to the server to see if the username already exists.


      The trigger is on the keydown but is always one keystroke behind. for example, if my text control contains abc, then the ws returns the value before the c is typed, e.g. ab. I see from the  Alert.show that the additional keycode has been registered and the control certainly displays the current value but the web service is always one character behind... Wondered anyone has any clue about this..

      Thanks in advance



      Client side


      <mx:TextInput id="ifp_screen_name"  width="240" keyDown="akey(event)"/>
           <mx:HTTPService id="nameSearch" url="http://example.com/taken.php" requestTimeout="1"
               useProxy="false" method="GET" showBusyCursor="false" result="resultHandler(event)" fault="faultHandler(event)" >
               <mx:request xmlns="">


      public function akey(event : KeyboardEvent) :void
            Alert.show(event.keyCode.toString()); // yep the key is there

      Server Side (taken.php)

      #$sn = mysql_real_escape_string($_GET['sn']);
      $sn = ($_GET['sn']);
      header('Content-type text/xml');
      echo "<results>";
      echo "<tag>1</tag>";
      echo "<tag>".$sn."</tag>";
      echo "<tag>3</tag>";
      echo "</results>";