我的 ActionScript 的ExternalInterface 回调函数未执行。我该如何调试它?

发布于 2024-08-04 08:54:29 字数 879 浏览 2 评论 0原文

请帮忙?看来我的回调函数没有被回调。我正在使用 jQuery 和 Flash 8。要访问 Flash 对象,我正在使用 jquery swfobject 插件,cf (http://jquery.thewikies.com/swfobject/examples)。如果您认为我一开始就没有正确访问 SWF,请推荐代码来说明我将如何做到这一点。谢谢!

JavaScript 代码:

$("#songplayer").flash("callCueSong(" + songid + ")");

Flash 代码:

import flash.external.*;
ExternalInterface.addCallback('callCueSong', null, cueSong);


stop();
pause = false;
pp_btn.hitArea = pause_hit_area;
love_btn.hitArea = love_hit_area;
_root.display_txt.backgroundColor = 0xffffff;

function cueSong(songid) {
    trace('Cueing track ' + songid);
    _root.sid = songid;
    _root.sound_mc.songStarter('sent', false);

}

MovieClip.prototype.songStarter = function(next_direction, feedback) {
      // code goes here
}

Help, please? It appears that my callback function isn't being called...back. I'm using jQuery, and Flash 8. To access the Flash object, I'm using the jquery swfobject plugin, c.f. (http://jquery.thewikies.com/swfobject/examples). If you think that I'm not accessing the SWF properly in the first place, please recommend code as to how I would do that. Thanks!

JavaScript Code:

$("#songplayer").flash("callCueSong(" + songid + ")");

Flash Code:

import flash.external.*;
ExternalInterface.addCallback('callCueSong', null, cueSong);


stop();
pause = false;
pp_btn.hitArea = pause_hit_area;
love_btn.hitArea = love_hit_area;
_root.display_txt.backgroundColor = 0xffffff;

function cueSong(songid) {
    trace('Cueing track ' + songid);
    _root.sid = songid;
    _root.sound_mc.songStarter('sent', false);

}

MovieClip.prototype.songStarter = function(next_direction, feedback) {
      // code goes here
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

記憶穿過時間隧道 2024-08-11 08:54:29

我的代码正在运行。我只是上传了错误的 SWF,并且没有发布到正确的位置。我通过放置以下调试代码并上传发现了它,并注意到虽然它出现在本地调试控制台中,但它没有出现在 Flash Tracer 中。

trace("Availability: " + ExternalInterface.available);

此外,我更改了 Flash 上的安全性。在 HTML 中,我将“AllowScriptAccess”设置为“始终”,在 SWF 中,我将:

System.security.allowDomain('http://www.mydomain.com', 'http://mydomain.com', 'mydomain.com', 'amazonaws.com');

感谢您的查看!希望你未来好运。

My code was working. I was simply uploading the wrong SWF, and not publishing to the right location. I discovered it by putting the following debug code, uploading, and noting that although it appeared in the local debug console, it did not appear in Flash Tracer

trace("Availability: " + ExternalInterface.available);

Also, I changed security on the Flash. In the HTML, I put "AllowScriptAccess" as "always", and in the SWF, I put:

System.security.allowDomain('http://www.mydomain.com', 'http://mydomain.com', 'mydomain.com', 'amazonaws.com');

Thanks for looking! Hope you have luck in the future.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文