1 Reply Latest reply on Apr 12, 2007 1:30 AM by kiers


      I've got a http service going to aPage.html and then in my application creationcomplete the following;

      try {
      catch(err:Error) {
      Alert.show("The data could not be found.");

      when aPage.html is not in the directory i get the dialog box erroring out...what have i done wrong here?
        • 1. Try/Catch
          The send call is Asynchronous, which means that the code continues rather than waiting for the HTTPService to complete.

          What you need to do is use eventListeners.

          in the function called by creationComplete:

          getData.addEventListener(ResultEvent.RESULT, getDataOK);
          getData.addEventListener(FaultEvent.FAULT, getDataFail);

          then you create two new methods:

          private function getDataOK(event:ResultEvent) {


          private function getDataFail(event:FaultEvent) {

          and in those, you put the code to handle the success/failure of the HTTP service

          Hope that helps