List files in a directory with AS

Hi all,

Just wondering if this could be done directly in Flash… Basically, what I want is a function that just opens a directory, check all the files that are in it, and place their filename into an array…

I know I can do this with PHP, then send results to flash, but I was wondering if this could be done directly in Flash…

Here is the code I want in PHP, my question is : Could that be “translated” to AS?

function listFiles($target) 
{ 
	$opnDir = opendir($target); 
	$fileArray = array(); 
	while ( ( $file = readdir($opnDir) ) !== false ) 
	{ 
		if ( ($file != ".") && ($file != "..") ) 
		{ 
			$fileArray[] = $file; 
		} 
	} 
	closedir($opnDir); 
}

Thanks,
Simo