[Flex Air] File 객체 생성

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

  xmlns:s="library://ns.adobe.com/flex/spark"

  xmlns:mx="library://ns.adobe.com/flex/mx"

  width="821" height="232"

  initialize="windowedapplication1_initializeHandler(event)" 

 >

<fx:Script>

<![CDATA[

import mx.collections.ArrayList;

import mx.events.FlexEvent;

import spark.events.IndexChangeEvent;

[Bindable]

private var ac:ArrayList;

protected function windowedapplication1_initializeHandler(event:FlexEvent):void{

ac = new ArrayList([

{label:"applicationStorageDirectory", value:File.applicationStorageDirectory}

, {label:"applicationDirectory", value:File.applicationDirectory}

, {label:"desktopDirectory", value:File.desktopDirectory}

, {label:"documentsDirectory", value:File.documentsDirectory}

, {label:"userDirectory", value:File.userDirectory}

]);

this.cbFile.addEventListener(IndexChangeEvent.CHANGE, combobox1_changeHandler);

this.cbFile.dataProvider = ac;

this.cbFile.selectedIndex = 0;

this.cbFile.dispatchEvent(new IndexChangeEvent(IndexChangeEvent.CHANGE));

}

protected function combobox1_changeHandler(event:IndexChangeEvent):void{

this.lbNativePath.text = File(cbFile.selectedItem.value).nativePath;

}

]]>

</fx:Script>

<s:ComboBox id="cbFile" x="9" y="22" width="199"/>

<s:Label id="lbNativePath" x="215" y="21" width="599" height="24" fontSize="13"

verticalAlign="middle"/>

</s:WindowedApplication>