在externalinterface.call方法中指定“请求方法”?

时间:2013-09-30 10:10:31

标签: actionscript-3 flex adobe

当用户尝试下载文件时,我需要打开一个新的html窗口并下载文件,目前iam使用“ExternalInterface.call”,但我需要设置“requestmethod”,否则服务器会抛出错误,如何指定“requestmethod”?

1 个答案:

答案 0 :(得分:0)

为什么不使用全局navigateToURL方法?您可以传入一个URLRequest对象,该对象具有一个名为method的属性,可以解决您的问题。

所以你需要这样的东西:

var request:URLRequest = new URLRequest("http://example.com");
request.method = URLRequestMethod.POST; // or anything you want

// parameters can be added to a URLVariables object 
// which then can be set as requests data property
// example:

var params:URLVariables = new URLVariables();
params.username = "test";
params.password = "123";

request.data = params;

// load the page
// specify '_blank' parameter to open it in a new browser window
navigateToURL(request, "_blank");