• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

object doesn't support this property or method

Guest
Mar 13, 2012 Mar 13, 2012

Copy link to clipboard

Copied

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>

TOPICS
ActionScript

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2012 Mar 13, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 14, 2012 Mar 14, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2012 Mar 14, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 19, 2012 Mar 19, 2012

Copy link to clipboard

Copied

Interesting. Have you ever tried callback yourself?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 19, 2012 Mar 19, 2012

Copy link to clipboard

Copied

LATEST

yes.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines