6 Replies Latest reply on Nov 30, 2007 12:35 PM by ntsiii

    RemoteObject not succeeding every time

    Chuckon
      I have specified a RemoteObject to return an ArrayCollection of String objects. It works sometimes so the ArrayCollection does contains the set of String objects and sometimes the ArrayCollection is null. I have debugged it and sometimes it works and sometimes it doesnt. I dont have a clue for the reason of this behavior. This is my code:

      [Bindable]
      private var products:ArrayCollection;
      private var rmOther:RemoteObject;
      ....

      private function initApp():void
      {
      products = new ArrayCollection()
      rmOther = new RemoteObject();
      rmOther.destination = "other";
      rmOther.addEventListener(ResultEvent.RESULT, resultHandler);
      rmOther.addEventListener(FaultEvent.FAULT, faultHandler);
      rmOther.getProducts();
      products = rmOther.getProducts.lastResult;
      ....
      }

      private function resultHandler(event:ResultEvent):void
      {
      products = event.result as ArrayCollection;
      }

      private function faultHandler(event:FaultEvent):void
      {
      Hourglass.remove();
      Alert.show(event.fault.faultString, 'Error')
      }

      The destination is properly configured and so on, otherwise it wouldnt work properly SOMETIMES

      This is ODD, PLEASE HELP

      Chuckon