BTA Flexing

My passion RIAs…………..Shardul Singh Bartwal

Reading File names inside a folder in Adobe AIR

Posted by Shardul Singh Bartwal on October 31, 2010

Reading the file names(including the folder names) in adobe air is a straight forward task.You have to decide the folder location i.e. desktop,document or application folder etc. And then you can get the file listing of that folder very easily. As I have done for a folder which is on my desktop.Below is code for the same.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
	creationComplete="getFolder()">
	<mx:Script>
		<![CDATA[
			private function getFolder() : void
			{
				var dir : File = File.desktopDirectory.resolvePath("MyFolder");
				dir.getDirectoryListingAsync();
				dir.addEventListener(FileListEvent.DIRECTORY_LISTING,onDirectoryListComplete);
			}

			private function onDirectoryListComplete(event : FileListEvent) : void
			{
				var cont : Array = event.files;
				for (var i : uint = 0;i<cont.length;i++)
				{
					trace(cont[i].name + "....." + cont[i].size);
				}
			}
			
		]]>
	</mx:Script>
	
</mx:WindowedApplication>
Advertisements

5 Responses to “Reading File names inside a folder in Adobe AIR”

  1. […] Continue reading here: Reading File names inside a folder in Adobe AIR « BTA Flexing […]

  2. […] Reading File names inside a folder in Adobe AIR « BTA Flexing […]

  3. […] Reading File names inside a folder in Adobe AIR « BTA Flexing […]

  4. […] Reading File names inside a folder in Adobe AIR « BTA Flexing […]

  5. […] Reading File names inside a folder in Adobe AIR « BTA Flexing […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: