views:

681

answers:

2

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
}
A: 

From just what I can see maybe this:

ExternalInterface.addCallback("callCueSong", null, cueSong);

Me and a friend worked on a few projects using ExternalInterface, could you also post the HTML as well as rest of the javascript for us to look at?

Leon
A: 

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.

Zachary Burt