Hi to al开发者_StackOverflowl stackoverflowers.
I've build a HTML5/jQuery application and I've incorporeted it in Adobe AIR.
I'm wondering if and how is it possible to tell AIR to open a filesystem folder window after clicking on a link in the HTML/jQuery application, something like
$('#button').click(function() {
var path = "my/path/"
openFolder(path);
});
I hope I was clear.
Any suggest will be strongly apreciated.
Thank you very much in advance.
Include AIRAliases.js from the air SDK
<script src="AIRAliases.js" type="text/javascript"></script>
and then use the following functions.
function openFolder(path) {
var file, loader, urlReq;
file = air.file.resolvePath(path);
file.addEventListener(air.Event.SELECT, function (e) {
loader = new air.Loader();
urlReq = new air.URLRequest(file.url);
loader.contentLoaderInfo.addEventListener(air.Event.COMPLETE, onFileLoad);
loader.load(urlReq);
});
file.browseForOpen("Open");
}
function onFileLoad(e) {
//Do something
}
//air
yourHTMLLoader.window.openFolder= openFolder; //assign Js function to air function
function openFolder(path:String):void
{
var file:File = File.documentsDirectory;
var fileOpen:File = file.resolvePath(path);
fileOpen.addEventListener(Event.SELECT, fileSelected); //if you want manage open file
fileOpen.browse();
}
精彩评论