【问题标题】:Add a cookie once flash banner is loaded on a web page在网页上加载 Flash 横幅后添加 cookie
【发布时间】:2023-03-15 03:40:01
【问题描述】:

我想在网页上加载 Flash 横幅后添加一个 cookie。 我在 html 标记中有 javascript 代码,我想使用 Actionscript3 在 .fla 文件中使用它。下面是 html 标签中的 Javascript 代码。我该怎么做?

<script type="text/javascript">
adroll_adv_id = "JD5ZGBNO4RBYVAMMMPX3J7";
adroll_pix_id = "CEJOJM5N5VAHBKCVMT2DML";
(function () {
var oldonload = window.onload;
window.onload = function(){
__adroll_loaded=true;
var scr = document.createElement("script");
var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
scr.setAttribute('async', 'true');
scr.type = "text/javascript";
scr.src = host + "/j/roundtrip.js";
((document.getElementsByTagName('head') || [null])[0] ||
document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
if(oldonload){oldonload()}};
}());
</script>

【问题讨论】:

    标签: javascript html actionscript-3 flash


    【解决方案1】:

    基本上你无法知道从外部加载 swf 文件的时间,必须使用 ExternalInterface 从内部完成调用

    ExternalInterface.call("loadCookie()");
    

    在您不能修改 SWF(您没有源代码)的特殊情况下,您可以创建自己的 swf,其尺寸与此横幅完全相同,在这个新的 swf 中,在代码中,你听一个加载器

    _loader = new Loader();
    _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteContentLoaderInfo);
    

    然后您触发对 Javascript 的 ExternalInterface 调用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-05
      相关资源
      最近更新 更多