Embedded flash movie says this: ExternalInterface.call ("testFunction()");
JS says this:
- embedFlash();
-
- $(document).ready(function() {
- function testFunction () {alert('function fired')};
- });
- function embedFlash () {
- var flashvars = {}; var params = {}; var attributes = {};
- params.AllowScriptAccess = "always";
- swfobject.embedSWF("flashMovie.swf", "flashContent", 100, 100, "9.0.0", "", flashvars, params, attributes);
- }
Doesn't work. When I move the testFunction outside of jQuery it works:
- embedFlash();
- function testFunction () {alert('function fired')};
-
- $(document).ready(function() {
- });
-
- function embedFlash () {
- var flashvars = {}; var params = {}; var attributes = {};
- params.AllowScriptAccess = "always";
- swfobject.embedSWF("flashMovie.swf", "flashContent", 100, 100, "9.0.0", "", flashvars, params, attributes);}
I realize it has something to do with the order of the DOM vs the Flash loading, but I don't know what to do about it. I need that function to be inside $(document).ready(function() { }); The function in question on the actual site is jQuery plugin function (jScrollPane api.getContentPane().load) - i.e. I am trying to get a button in the flash movie to load content into a jScrollPane. If I move that function outside of jQuery, it is recognized by flash, but it doesn't function.
I have tried moving the embedFlash inside the $(document).ready(function() { }), I tried using a swfObject call back to make sure the flash is loaded - nothing works.
I should say that I am a medium level programmer, so sorry if I am missing something obvious.