Hi.
I'm trying to write a simple flash mp3 player while using JQuery and it's SWF Object plugin. I'm adding an swf to the page using this code:
$("body").append("<div id='player_external' style='position:absolute;top:0;left:0;height:1px;width:1px;'></div>");
$('#player_external').flash({swf:"player_external.swf",wmode:"transparent",height:1,width:1,AllowScriptAccess:"always"});
The player should be invisible one-pixel object that interacts with javascript.
When i'm calling javascript functions from within flash objects (using ExternalInterface.call()
) it works fine.
But when i try to call ActionScript function from JavaScript nothing happens. I have added a callback function like this:
ExternalInterface.addCallback("MyFunc",MyFunc);
And I've tried all possible ways I've found on the internet. Like:
$('#player_external').context.MyFunc();
$('#player_external').flash("MyFunc()"); //this just crashes browser!
Also, the solution found here: http://stackoverflow.com/questions/1473741/ doesn't help. I gave up my hope on this. Maybe it's better to use flash without JQuery's help. But there just should be some way to do this.
Thanks.