1 Reply Latest reply on Apr 18, 2007 4:19 AM by MotionMaker

    weired error with LoadVars

    Level 7
      Hi,
      the movie i made is calling 2 different asp function which update a DB and
      return an updated XML if all is fine.
      i'm doing this using a 'LoadVars' object, with the 'sendAndLoad' method.
      when i'm testing it in the working environment all works fine. when i'm
      testing it inside a browser (after i put my swf in the local server), one of
      the functions does what its suppose to do, however the other one keeps
      failing...

      this is my code basically:

      var setData:LoadVars = new LoadVars();
      setData.onLoad = function(ok) {
      if (ok) {
      trace("ok");
      } else {
      trace("fail");
      }
      }
      ...
      function updateImp(){
      var params = "setImp&id="+impId;
      params+="impText="+impText;
      ...
      setData.sendAndLoad(aspPath+"calendarFunctions.asp?f="+params,setData)
      }

      function updateTraining(){
      var params = "setTraining&id="+trainId;
      params+="trainText="+trainText;
      ...
      setData.sendAndLoad(aspPath+"calendarFunctions.asp?f="+params,setData)
      }

      both function work fine in the authoring environment, however only the first
      one functions online, the second one always returns 'fail' in the 'onLoad'.
      just for testing, i replaced in the second function the 'sendAndLoad' with
      just 'send' -
      'setData.send(aspPath+"calendarFunctions.asp?f="+paramsList,"_blank");' -
      and guess what, in the window that was opened i got the XML i was expecting
      to...
      on the server side, the functions in the asp file are identical, so that not
      the place to look for the bug either.

      any ideas?!?!?!?!?

      thanks,
      eRez


        • 1. Re: weired error with LoadVars
          MotionMaker Level 1
          1. Add a TextField or TextArea component to your movie and trace the arguments to the sendAndLoad.
          2. Are both functions being called before the onLoad on one completes? If so that may be a problem since they both use the same onLoad.
          3. Not sure about using the same LoadVars for the return object. Try following the example for LoadVars.sendAndLoad. There you have two LoadVars objects, one for send and one for return. As well you also notice how to create the send variables by simply making the part of the send LoadVars object.