2 Replies Latest reply on Oct 17, 2006 8:17 AM by Newsgroup_User

    Timeout in LoadVars

    Level 7
      I have a question that seems to have come up a few times without any solid
      answers.

      How long is the timeout for an onLoad event from sendAndLoad?

      I have a script that takes about 500K of data sent from flash and does some
      image processing. The whole think takes about 35 seconds or so.

      But, even though my script eventually returns a properly formatted value for
      the LoadVars object to parse, it does not get called.

      I have also tried the onData with the same results.

      From what I have been able to determine it will time out after 30 seconds.

      Is there a way to change this? Any good ideas on a hack fix? I could write
      a setInterval function to call another script every 5 seconds until "true"
      is returned (or whatever) but would like to find a better way.

      Thanks


        • 1. Re: Timeout in LoadVars
          AnandMX Level 1
          best way is to use getTimer, setTimer
          • 2. Re: Timeout in LoadVars
            Level 7

            "AnandMX" <webforumsuser@macromedia.com> wrote in message
            news:eh2d7o$s87$1@forums.macromedia.com...
            > best way is to use getTimer, setTimer

            Never heard of setTimer... is it an undocumented function?

            And why do you suggest getTimer over a setInterval? I don't want to bank on
            the fact that the process takes 35 seconds because I think it sometimes
            takes up to 45. So, how would you use getTimer to help in this situation?

            I am now using setInterval like so...

            var sId:Number;
            var _lv = new LoadVars();
            sId = setInterval(checkForFileExistence, 2500, filename);

            function checkForFileExistence(fname:String):Void {
            _lv.fname = fname;
            _lv.onLoad = function(success:Boolean):Void {
            if (success) {
            if (_lv.fileExists == "1") {
            okay;
            clearInterval(sId);
            else {
            not okay;
            }
            }
            }
            _lv.sendAndLoad(' http://mydomain.com/scriptname.py', _lv, "POST");
            }