Apache flex internet explorer中的Adobe air.navigateToURL错误
我的AdobeAIR应用程序有一个非常奇怪的问题。我有一个方法,可以启动一个本地HTML文件,并将一些查询字符串项传递给它 代码如下:Apache flex internet explorer中的Adobe air.navigateToURL错误,apache-flex,flash,air,Apache Flex,Flash,Air,我的AdobeAIR应用程序有一个非常奇怪的问题。我有一个方法,可以启动一个本地HTML文件,并将一些查询字符串项传递给它 代码如下: function printWin(def) { def = encodeURI(def); var req = new window.runtime.flash.net.URLRequest('print.html'); req.method = 'GET'; var urlvars = new window.r
function printWin(def) {
def = encodeURI(def);
var req = new window.runtime.flash.net.URLRequest('print.html');
req.method = 'GET';
var urlvars = new window.runtime.flash.net.URLVariables("d="+def);
req.data = urlvars;
air.navigateToURL(req);
return false;
}
问题是,如果在internet explorer完全关闭时运行此代码,则可以创建如下URL:
file:///C:/Program%20Files%20x86/Gastrointestinal%20Tumors%20Dictionar/print.html?d=ABC
但是,如果internet explorer已在运行且代码已运行,则将创建以下URL:
C:\程序文件
x86\胃肠道肿瘤
Dictionary\print.html
我不知道这是为什么,但不幸的是,我需要尝试和解决这个紧急。有人有什么想法吗?你能尝试构建完整的URL而不是使用相对的print.html吗 试试这个:
var url:String = File.applicationDirectory.url.substring(0, File.applicationDirectory.url.lastIndexOf("/") + 1) + "print.html";
var req = new window.runtime.flash.net.URLRequest(url);
...
那会让你得到全部的file:///-style 每次都是URL。substring方法试图删除当前文件,这样您就可以进入当前目录,这样您就可以创建一个相对路径,只是现在它完全限定为您的应用程序根目录。您可以尝试构建完整的URL而不是使用相对print.html吗 试试这个:
var url:String = File.applicationDirectory.url.substring(0, File.applicationDirectory.url.lastIndexOf("/") + 1) + "print.html";
var req = new window.runtime.flash.net.URLRequest(url);
...
那会让你得到全部的file:///-style 每次都是URL。substring方法试图删除当前文件,这样您就可以进入当前目录,这样您就可以创建一个相对路径,只是现在它完全符合应用程序根目录的条件