Flex 中保存文件对话框中显示默认文件名
var file:File;
protected function browseButton_clickHandler(event:MouseEvent):void
{
????var zipFileName:String = "\\test.zip ";
????if(null == file){
?????file = new File(zipFileName);
????}
????file.addEventListener(Event.SELECT,saveFileSelectHandler);
????file.browseForSave("Save archive copy as");
}
?
protected function saveFileSelectHandler(event:Event):void
{
????saveFileTxt.text = file.nativePath;
????downLoadPath = "file://"+file.nativePath;
}
?
<s:Group top="0" left="10" right="0" bottom="10" excludeFrom="exporting,exported">
??<s:layout>
???<s:VerticalLayout gap="-5" paddingLeft="17" paddingRight="17" paddingBottom="13" paddingTop="25" />
??</s:layout>
??<s:VGroup width="100%" paddingLeft="8" paddingRight="8" paddingBottom="6" paddingTop="6">
???<s:Label text="Please choose where to save exported project"/>
???<s:HGroup width="100%" height="25" verticalAlign="middle" paddingLeft="24">
????<s:TextInput id="saveFileTxt" width="400" textAlign="left" editable="false"/>
????<s:Button id="browseButton" label="Browse" click="browseButton_clickHandler(event)"
??????? height="100%" buttonMode="true" right="3"/>
???</s:HGroup>
??</s:VGroup>
</s:Group>
?
效果如下图:
?
?
?
?
?
?