Skip navigation
chris.watson.media@gmail.
Currently Being Moderated

finding mp3 files on android phone using air

Aug 20, 2012 8:02 PM

I'm trying to display all mp3 files on a phone in a list but I can't seem to figure out how to access the files on the phone.

 

I'm trying things like:

var file:File = File.desktopDirectory; // I read that this gave me /mnt/sdcard on an android phone

var files:Array = file.getDirectoryListing();

 

but if I trace the length of files it equals 0.

 

What do I have to do to find all the files?

 
Replies
  • Currently Being Moderated
    Aug 21, 2012 1:16 AM   in reply to chris.watson.media@gmail.

    use getDirectoryListingAsync(); method and add event listener to the file

    file.addEventListener(FileListEvent.DIRECTORY_LISTING,ff);

    protected function ff(event:FileListEvent):void

                        {

                        var file:File= event.target as File;

    var  arr:Array=file.getDirectoryListing();

    trace(arr.length);

     

     

     

     

                        }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points