【问题标题】:Passing variables through navigateURL to open iFrame as3通过 navigateURL 传递变量以打开 iFrame as3
【发布时间】:2014-10-03 15:11:47
【问题描述】:

通过使用 NavigateURL,我可以轻松地将如下变量通过 Flash 传递到贝宝,这没有问题,并且可以包含所有需要的数据。

var req:URLRequest = new URLRequest("https://www.paypal.com/cgi-bin/webscr");
var reqVars:URLVariables = new URLVariables();
reqVars.cmd = "_xclick-subscriptions";
reqVars.business = "BUSINESS CODE";
reqVars.lc = "GR";
reqVars.item_name = "Product Name";
reqVars.item_number = "Product Number 0001";
reqVars.no_note = "1";
reqVars.no_shipping = "2";
reqVars.src = "1";
reqVars.a3 = "15.00";
reqVars.p3 = "1";
reqVars.t3 = "Y";
reqVars.currency_code = "EUR";

//and so on
req.data = reqVars;
req.method = URLRequestMethod.POST;
navigateToURL(req);

通过使用如下所示的 callIframe,我可以轻松地从 Flash 中打开 iFrame。

calliFrame("http://www.webAddress.com/" +"?iframe=true&width=800&height=550", "Page Title", "Page Description");

function calliFrame(url:String, title:String, desc:String):void{
    if (ExternalInterface.available) {
        trace("calling prettyPhoto");
        try {
            ExternalInterface.call('$.prettyPhoto.open', url, title, desc);
        } catch (event:Error) {
            trace("Error occurred!");
        }
    } else {
        trace("External Interface unavailable");
    }
}

是否可以通过 calliFrame 方法传递 navigateURL 变量?我尝试了各种变体,但无法传输数据或显示页面。

我希望像下面的例子一样可以工作,但只会得到一个空白页面或 iFrame 中显示的数据列表:

calliFrame("https://www.paypal.com/cgi-bin/webscr" +reqVars +"?iframe=true&width=800&height=550", "Page Title", "Page Description");

任何帮助将不胜感激,在此先感谢。

【问题讨论】:

    标签: actionscript-3 iframe paypal navigateurl


    【解决方案1】:

    第二个参数是窗口名称,因此您只需传递 iframe 的名称即可。

    public function navigateToURL(request:URLRequest, window:String = null):void
    

    文档:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html#navigateToURL()

    【讨论】:

    • 谢谢@bribeiro。花了一点时间尝试了许多选项,我认为这可能是一个安全问题,尽管 Paypal 和 Facebook 现在使用 iFrame 实现相同的逻辑。无论如何,我会尝试您的建议,并且可能可以在其他地方实施它们,但我怀疑在 iFrame 中从我的网站打开贝宝是不可行的。 . .悲哀。
    猜你喜欢
    • 2010-12-30
    • 1970-01-01
    • 1970-01-01
    • 2013-03-14
    • 1970-01-01
    • 2018-10-11
    • 2011-10-19
    • 2014-12-25
    • 2015-06-23
    相关资源
    最近更新 更多