[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; private var directory:File = File.documentsDirectory; private function initApp():void { directory.addEventListener(Event.SELECT, directorySelected); } private function onClick():void { try { directory.browseForDirectory("Select Directory"); } catch (error:Error) { trace("Failed:", error.message) } } private function directorySelected(event:Event):void { directory = event.target as File; var files:Array = directory.getDirectoryListing(); var filenames:ArrayCollection = new ArrayCollection(); for (var i:uint = 0; i < files.length; i++) { filenames.addItem(files[i].name); } fileList.dataProvider = filenames; } ]]> </mx:Script> <mx:Button label="open" click="onClick()"/> <mx:List id="fileList" width="100%" height="100%"/> </mx:WindowedApplication>