1 Reply Latest reply on May 7, 2012 12:27 AM by Z4g0s

    getDirectoryListingAsync stop and block UI refresh


      I have a problem using the getDirectoryListingAsync, to obtain the list of files in a specific folder...


      Calling the getDirectoryListingAsync method on a folder with a lot of files (in my test >20000) the UI stop to refresh until the listing is done...


      Shouldn't  an async method act differently? it seems like I'm using the normal one...


      I think that the list of files is collected correctly, but during the conversion in the arraycollection the function that generate this runs on the same thraed of the UI and then with a large amount of files (large arraycollection) there is a block of the UI!


      here is a snippet of  code:

      private function checkFoto(dir:File):void
         if (dir.exists)
           dir.addEventListener( FileListEvent.DIRECTORY_LISTING, listaImmaginiLocale);
           dir.getDirectoryListingAsync(); // after this point, for the firsts seconds the UI respond well, after few seconds (I suppose before the conversion to an ArrayCollection) the UI is frozen
      private function listaImmaginiLocale( event:FileListEvent ):void
       // from this point on the UI is responsive again...


      any suggestion are appreciated...

      I'm using Flex 4.5