Skip to main content
March 21, 2012
Answered

Callback in FF

  • March 21, 2012
  • 1 reply
  • 2000 views

Hi all,

Here is my second post. My environment is:

Win7 pro 64bit. FireFox 11.0.  Flash Player 11.1.102.63. Following code works in IE8 but not FF, can someone have some input?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
var f32=function f32(p)   {    alert(p)  };
(function(){
    var f30=function f30() {
      window.setTimeout(f33, 2000     } 
var f33=function f33(){
   var a=document.getElementById("testff");
   a.f33()  }
  f30();
})();
</script></head>

<body>
<div id="test">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"
width="215" height="318" id="testff" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="testff.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="transparent" />
    <param name="bgcolor" value="#ffffff" />
    <embed src="testff.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="215" height="318" name="testff" align="middle" allowScriptAccess="always"
    allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>
</div></body></html>

------

import flash.external.ExternalInterface;

flash.system.Security.allowDomain("*");

startTest();

function f0():void {
   ExternalInterface.call("f32", "One");
}
function startTest():void {
ExternalInterface.addCallback("f33", f0);
}

This topic has been closed for replies.
Correct answer kglad

Do you mind pointing out one or two?

There is nothing against a dotcom ad if it truely helps.


the biggest problem is document.getElementById("testff"); is not a correct reference to your swf for using externalinterface.  check the files i linked (or the flash help files) for how to create a correct reference.

1 reply

kglad
Community Expert
Community Expert
March 21, 2012

start with the code in the flash help files.  once you have that working, make small adjustments, repeatedly testing until you have it working.

March 22, 2012

This kglad guy is driving me nuts.

Have you tried my code? does it work? do you see any problem in my code? your answer applies to any question in any group. it's meaningless. There are things can stop as3 callback from working, like using a debug version of flash player or something thing I don't know. I'm seeking a decent programmer gives me hints on possible cause or troubleshooting, anyone?

thanks.

the original post has an error during editting:

window.setTimeout(f33, 2000) }

kglad
Community Expert
Community Expert
March 22, 2012

yes, you have errors.  you have so many problems that it will be easier to start with something that works and then adjust that to meet your needs rather than start with your code and fix it.

that's my opinion.   if you don't get it, ok.  there's no reason to be rude.

here's how to use the externalinterface class:  http://www.kglad.com/Files/forums/extint.zip