A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: displaying Directory contents with AIR/Flash CS3 component

  1. #1
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194

    displaying Directory contents with AIR/Flash CS3 component

    Hi,

    I've tried using this

    Code:
    // List the contents of the user's home directory
    var dir:File = File.userDirectory;
    dir.listDirectoryAsync();
    				
    // Listen for the appropriate event to handle when the listing is complete
    dir.addEventListener( FileListEvent.DIRECTORY_LISTING, 
                          handleDirectoryListing );
    
    			
    private function handleDirectoryListing( event:FileListEvent ):void
    {
        // Display a header
        trace( "Name\tSize\tDir?\tCreated On" );
    				
        // Loop over all of the files and subdirectories, and display 
        // some relevant information about each item in the console window
        for each ( var item:File in event.files )
        {
            trace( item.name + "\t" 
                 + item.size + "\t" 
                 + item.isDirectory + "\t" 
                 + item.creationDate );
        }
    }
    with the Flash AIR component, but it gives me this compile error

    "1046: Type was not found or was not a compile-time constant: FileListEvent."

    thanks for any help.

  2. #2
    Interactive Developer
    Join Date
    Oct 2007
    Location
    Saint Louis
    Posts
    10

    An example usage

    Boombanguk,
    I know you are using Flash CS3 with AIR, but I have this posting I created based on your example. Granted it uses Flex but I would think the syntax would be the same...

    http://tdotblog.info/?q=node/7

    A couple of things I noticed. The asynchronous method is actually "getDirectoryListingAsync." In addition you may want to make sure you have all the necessary classes imported.

    I know the initial beta of AIR had a decent number of bugs in it so that may have caused problems as well...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center