您的位置:首页 > 移动开发

AIR 用系统默认应用打开文件 Open with default App

2011-03-24 09:14 441 查看


<?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" styleName="plain" width="100%" height="100%">
<fx:Script>
<![CDATA[
import flash.events.MouseEvent;

import mx.controls.FileSystemDataGrid;

protected function datagridHandler(event:MouseEvent):void
{
var fsg:FileSystemDataGrid = event.currentTarget as FileSystemDataGrid;
if (fsg.selectedItem != null)
(fsg.selectedItem as File).openWithDefaultApplication();
}
]]>
</fx:Script>

<s:Panel width="100%" height="100%" title="Open With Default Application Sample" skinClass="skins.TDFPanelSkin">
<s:VGroup top="10" left="10">
<s:Label width="660" verticalAlign="justify" color="#323232"
text="The Open With Default Application support allows you to open any file with it's associated default application. Locate a file
item in the file system grid and double-click it to see it in action:"/>
<mx:Button icon="@Embed(source='up.png')" click="fileGrid.navigateUp();"
enabled="{fileGrid.canNavigateUp}"/>
<mx:FileSystemDataGrid id="fileGrid" directory="{File.desktopDirectory}" width="660" height="150"
doubleClickEnabled="true" doubleClick="datagridHandler(event)">
</mx:FileSystemDataGrid>
</s:VGroup>
</s:Panel>

</s:WindowedApplication>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐