1 Reply Latest reply on Feb 11, 2008 11:26 AM by kcell

    Any help appreciated

      I am calling to two functions from a web service which fill (2) array collections then plot those two series in a Chart component. The problem is that the system often will be looking for series2 data in the series1 Array Collection, and I will, of course, get an 'not found' error.

      It is intermittent. How can I very the Array Collections are filled before calling the Chart Component, or better, call the HOLC Chart Series once the HLOC array collection is filled and then the Plot series once the Plot series Array Collection is filled?

      here is some examples of the code.

      -----------------------------create array collections

      import DTO.Tickers;
      import DTO.Trades;
      import mx.collections.ArrayCollection;
      import mx.controls.Alert;
      import mx.rpc.events.ResultEvent;
      import mx.collections.SortField;
      import mx.collections.Sort;

      public var Array_Tickers:ArrayCollection;

      private function Tickers_result(e:ResultEvent):void{

      Array_Tickers = e.result as ArrayCollection;
      for (var i:int=0;i<Array_Tickers.length;i++)
      { var Current_ticker:Tickers = new Tickers();
      Current_ticker = new Tickers(Array_Tickers.getItemAt(i));
      Array_Tickers.setItemAt(Current_ticker, i);

      public var Array_Trades:ArrayCollection;

      private function Trades_result(e:ResultEvent):void{

      Array_Trades = e.result as ArrayCollection;
      for (var i:int=0;i<Array_Trades.length;i++)
      { var Current_trade:Trades = new Trades();
      Current_trade = new Trades(Array_Trades.getItemAt(i));
      Array_Trades.setItemAt(Current_trade, i);

      ____________web service calls

      <mx:WebService id="WsChartVt" wsdl=" http://localhost:1240/CHARTVT/MyChartVT.asmx?WSDL">
      <mx:operation name="GetTickers" result="Tickers_result(event)" />
      <mx:WebService id="WsTradeVt" wsdl=" http://localhost:2792/CHARTVT/MyTradeVT.asmx?WSDL">
      <mx:operation name="GetTrades" result="Trades_result(event)" />

      _---------------------------initialize the web operations...

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      layout="absolute" enabled="true" verticalScrollPolicy="off"
      visible="true" initialize="WsTradeVt.GetTrades()"
        • 1. Any help appreciated
          kcell Level 2

          When the service calls return, check if the other array has a length and if yes, call the chart component with both arrays.

          What seems a little bit wrong/confused is the code in the results handlers. (but I never had worked with the charte before)

          I would write it like this ( just the first func as an example):
          private function Tickers_result(e:ResultEvent):void{
          if ( e.result is ArrayCollection)
          var tempArray:ArrayCollection = e.result as ArrayCollection;
          for (var i:int=0;i<tempArray.length;i++)
          var Current_ticker:Tickers = new Tickers(tempArray.getItemAt(i));
          /// afterwards check if both array are filled and if yes call the component