title: Return Array in ActionScript 3.0 (Flash and Air)
body: <p>Hey guys, I'm trying to get the name of every files from a specific folder into an array,
  but I get this error and I can't find why... this may be a stupid question but whatever.</p>
  
  <blockquote>
    <p>TypeError: Error #1009: Cannot access a property or method of a null object reference.</p>
  </blockquote>
  
  <p>Here's my code:</p>
  
  <pre><code>import flash.filesystem.File;
  
  function getFileList(directory:String):Array
  {
  var folder:File = new File(directory);
  var files:Array = folder.getDirectoryListing();
  var fileList:Array;
  
  for(var i = 0; i &lt; files.length -1; i++)
  {
  var path:String = files[i].nativePath;
  var split:Array = path.split(File.separator);
  fileList[i] = (split[split.length -1]);
  }
  return fileList;
  }
  
  var list:Array = getFileList("E://Whatever//Whatever");
  </code></pre>