2009-09-08 68 views
0

请帮忙吗?看起来我的回调函数没有被调用...回来。我使用的是jQuery和Flash 8.为了访问Flash对象,我使用了jquery swfobject插件c.f. (http://jquery.thewikies.com/swfobject/examples)。如果您认为我没有正确访问SWF,请推荐我如何做到这一点的代码。谢谢!我的ActionScript的ExternalInterface回调函数没有经过。我该如何调试它?

JavaScript代码:

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

闪存代码:

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 
} 

回答

0

我的代码是工作。我只是简单地上传了错误的SWF,而没有发布到正确的位置。我通过添加如下调试代码,上传,并指出,虽然它出现在本地调试控制台,它并没有出现在Flash示踪

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

也发现了它,我对Flash改变安全。在HTML中,我将“AllowScriptAccess”设置为“always”,并在SWF中放入:

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

感谢您的期待!希望你有未来的运气。