1 Reply Latest reply on Aug 20, 2008 2:47 AM by Dr. Fred Mbogo

    Can't asynchronous in Axaj after packing the app to air

    bestjamie
      When I run the app with SDK, everything is ok.
      But after packing the app to *.air, it can't work well.
      Following are some logs of OK & NG situation:
      OK
      folderContent[0]: id=0011
      properties=name=AIR_Replicator.jpg;
      folderContent[1]: id=0202
      properties=name=LineCount_1.jpg
      folderContent[2]: id=0092
      properties=name=texdtw.jpg
      folderContent[3]: id=0219
      properties=name=dageed.jpg

      NG
      folderContent[0]: id=0011
      folderContent[1]: id=0202
      folderContent[2]: id=0092
      folderContent[3]: id=0219

      properties=name=dageed.jpg
      properties=name=dageed.jpg
      properties=name=dageed.jpg
      properties=name=dageed.jpg

      Why the application can't run asynchronously?

      pseudo code:
      .........
      .........
      if (readyState == 4) { //request is finished
      if (status == 200) { //and successful
      for (i = 0; i < folderContent.length; i++) {
      logger("folderContent[" + i + "]: id=" + folderContent )
      getFileProperty(folderContent
      );
      }
      }
      }
      function getFileProperty(id){
      .........
      .........
      if (readyState == 4) { //request is finished
      if (status == 200) { //and successful
      logger("properties=name=" + id.name);
      }
      }
      }
      Could you please do me a favor?
      Thanks so much
        • 1. Re: Can't asynchronous in Axaj after packing the app to air
          Dr. Fred Mbogo Level 1
          Are you testing your original pages in a WebKit browser? That is, either the open source version, Safari or Konqueror? AIR uses WebKit, too, so if you test in some other browser then package for AIR, you could be running into cross-browser compatibility issues.

          I suggest this because it seems you're hand-rolling your Ajax code instead of using one of the Ajax libraries, which solve these compatibility issues internally. Personally, I use Prototype. Great stuff. I really hate programming active web sites without it now.