Skip to main content
March 13, 2012
Question

object doesn't support this property or method

  • March 13, 2012
  • 1 reply
  • 2418 views

Hi all,

I'm testing AS3 calling Javascript. It works in FF but not in IE8. I'm suspecting is a version problem but not sure.Can someone take a look? TIA  -s

Here is my environment:

OS: Win7 Pro 64bit.

CS4 installed.

then Flash player updated to 11.1 (no touch to the CS4 Flash installation dirs).

Here is the AS3 code:

import flash.external.ExternalInterface;

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

startTest();

function f0():Boolean {
ExternalInterface.call("ff1");
return true;
}
function startTest():void {
if (ExternalInterface.available) {
  try {
   ExternalInterface.addCallback("f100", f0);
  } catch (error:Error) {
   trace("An Error occurred: " + error.message + "\n");
  }}}

Here is Javascipt part:

<script type="text/javascript">
   function ff1()   {    alert("From AS")   }
function f101() {    window.setTimeout(f100, 2000)   } 
  function f100(){
   var a=document.getElementById("fltest");
  a.f100() // got error message here
  }
window.onload= f101;
</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#ve rsion=10,0,0,0" width="215" height="318" id="fltest" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="test.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /> <embed src="pet.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="215" height="318" name="fltest" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>
</div>

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 13, 2012

if you're not seing that alert "From AS", you probably have incorrect swf embedding code.  to remedy, use the embedding code published by flash.

i wouldn't expect your addCallback is going to work.  to remedy, check the flash help files for sample callback code.

March 15, 2012

After remove/reinstall Flash CS4, I cahnged above allowscriptaccess to "always". This time, it works in IE8 but FF shows "a.f100 is not a function"?

Please help.

kglad
Community Expert
Community Expert
March 15, 2012

a.f100 makes no sense.

are you trying to call an actionscript function from javascript?  if so, check the flash help files (externalinterface) for info and sample code on how to use addcallback.