Flash External Interface issue with Firefox

Posted by majestiq on Stack Overflow See other posts from Stack Overflow or by majestiq
Published on 2009-05-12T14:52:41Z Indexed on 2010/05/05 23:28 UTC
Read the original article Hit count: 313

I am having a hard time getting ExternalInterface to work on Firefox. I am trying to call a AS3 function from javascript. The SWF is setup with the right callbacks and it is working in IE.

I am using AC_RunActiveContent.js to embed the swf into my page. However, I have modified it to add an ID to the Object / Embed Tags. Below are object and embed tag that are generated for IE and for Firefox respectively.

    <object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="400" height="400" align="middle" id="jpeg_encoder2" name="jpeg_encoder3" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" >
    <param name="movie" value="/jpeg_encoder/jpeg_encoder3.swf" /> 
    <param name="quality" value="high" /> 
    <param name="play" value="true" /> 
    <param name="loop" value="true" /> 
    <param name="scale" value="showall" /> 
    <param name="wmode" value="window" /> 
    <param name="devicefont" value="false" /> 
    <param name="bgcolor" value="#ffffff" /> 
    <param name="menu" value="false" /> 
    <param name="allowFullScreen" value="false" /> 
    <param name="allowScriptAccess" value="always" /> 
</object>


<embed 
    width="400" 
    height="400" 
    src="/jpeg_encoder/jpeg_encoder3.swf" 
    quality="high" 
    pluginspage="http://www.macromedia.com/go/getflashplayer" 
    align="middle" 
    play="true" 
    loop="true" 
    scale="showall" 
    wmode="window" 
    devicefont="false" 
    id="jpeg_encoder2" 
    bgcolor="#ffffff" 
    name="jpeg_encoder3" 
    menu="false" 
    allowFullScreen="false" 
    allowScriptAccess="always" 
    type="application/x-shockwave-flash" > 
</embed>

I am calling the function like this...

<script>
try {
    document.getElementById('jpeg_encoder2').processImage(z);
} catch (e) { alert(e.message); }
</script>

In Firefox, I get an error saying "document.getElementById("jpeg_encoder2").processImage is not a function"

Any Ideas?

© Stack Overflow or respective owner

Related posts about flash

Related posts about externalinterface