Skip navigation
seanad1209
Currently Being Moderated

object doesn't support this property or method

Mar 13, 2012 3:42 PM

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>

 
Replies
  • kglad
    72,357 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 13, 2012 3:55 PM   in reply to seanad1209

    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.

     
    |
    Mark as:
  • kglad
    72,357 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 14, 2012 8:30 PM   in reply to seanad1209

    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.

     
    |
    Mark as:
  • kglad
    72,357 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 19, 2012 10:13 PM   in reply to seanad1209

    yes.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points