code_junkie

as3 ExternalInterface.addCallback is not working right

Nov 12th, 2011
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. document.observe('dom:loaded', function() {
  2. $('episode1').observe('click', function() {
  3. var params = {wmode : "transparent", allowScriptAccess:"always", movie:"header"};
  4. swfobject.embedSWF("swf/float.swf", "header", "100%", "100%", "9.0.0","expressInstall.swf", "", params, "");
  5. sendToActionScript("ep1.swf");
  6.  
  7. });
  8. })
  9. function thisMovie(movieName) {
  10.  
  11. if (navigator.appName.indexOf("Microsoft") != -1) {
  12. return window[movieName];
  13. } else {
  14. //alert("aaa")
  15. return document[movieName];
  16. }
  17. }
  18. function sendToActionScript(value) {
  19. thisMovie('header').sendToActionScript(value);
  20. }
  21.  
  22. private function receivedFromJavaScript(value:String):void {
  23.  
  24. loader.load(new URLRequest(value));
  25.  
  26. }
  27.  
  28. var timeoutId;
  29. var js_initiate_callback = function() {
  30. // This is the swf object:
  31. fvar_js.js_to_as_f();
  32. clearTimeout ( timeoutId );
  33. }
  34. var reset_fvar_f = function(new_val) {
  35. fvar_val = new_val;
  36. }
  37. //js_initiate_callback();
  38. timeoutId = setTimeout(js_initiate_callback, 1000);
  39.  
  40. function GetSWF(strName) {
  41.  
  42. if (window.document[strName] != null)
  43. if (window.document[strName].length == null)
  44. return window.document[strName];
  45. else
  46. return window.document[strName][1];
  47. else
  48. if (document[strName].length == null)
  49. return document[strName];
  50. else
  51. return document[strName][1];
  52.  
  53. }
  54.  
  55. function GetSWF(strName) {
  56.  
  57. if (window.document[strName] != null)
  58. if (window.document[strName].length == null)
  59. return window.document[strName];
  60. else
  61. return window.document[strName][1];
  62. else
  63. if (document[strName].length == null)
  64. return document[strName];
  65. else
  66. return document[strName][1];
  67.  
  68. }
Add Comment
Please, Sign In to add comment