Search code examples
apache-flexfileairwindows-explorer

Adobe AIR - Options to open folder in Windows Explorer


Hello StackOverflow community,

Is there any way to open a folder in Windows Explorer from Adobe AIR?

It looks like these APIs won't be added until AIR 2.0, but until then are there any workarounds that can be used to enable this feature?

Thanks, Mauricio


Solution

  • Try to launch a new URLRequest for the file name. In theory, it will send that request to the default browser on the Windows machine, which will probably open the folder.

    Something like this:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script><![CDATA[
    import flash.net.URLRequest;
    
    public function clickButton():void{
    var request : URLRequest = new URLRequest('C:\\projects\\');
    navigateToURL(request )    
    }
    ]]></mx:Script>
    
    <mx:Button click="clickButton()" />
    </mx:WindowedApplication>
    

    Code sample taken from one of my older blog posts: http://www.jeffryhouser.com/index.cfm/2008/4/22/Using-AIR-to-launch-other-applications