问题描述:

Is there a way that I can pass the value of app: or appstorage: to a javascript file which has been included via URLRequest?

I have a web application with an HTML5 video player, and I've been asked to get it to work as an AIR app. So far so good, except that there is a bug in jPlayer that requires you to use absolute file paths for media if you're using flash fallback.

I need to get the file path of the app: or appstorage: directory on a users machine, and pass that to javascript so that the player can find my videos.

网友答案:

Yes there is a way. Setup a sandbox bridge. See: Cross-scripting content in different security sandboxes in the Adobe Flex 3 Help documents.

网友答案:

You can use AIRAliases.js which is in a folder in the Air SDK package, and "resolve" the path via Javascript like this:

var path = air.File.applicationDirectory.resolvePath("your/path/file.ext");

or

var pathObj = air.File.applicationDirectory.resolvePath("your/path/");
var path = pathObj.url;

so your file could be located via absolute path with something like:

path + "/file.ext"
相关阅读:
Top