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

来源:互联网 发布:趋势图指标源码 编辑:程序博客网 时间:2024/06/15 12:07

<?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 fileitem 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>

 

原创粉丝点击