@ifl

If all you want is to invoke a External interface method, then check out the
static communications example page here:

Static publishing

http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test_com.html

(with callback)
http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test_com2.html


Dynamic publishing:
http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test_dynamic_com.html

(with callback)
http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test_dynamic_com2.html


The examples show all communication methods possible including EI, getURL,
and setVariable. I would get a sanity check with the examples, as your code
is using some unecessary methologies like writing your own onload handlers
and querystring inspectors. Also "document.flashContent" in  formSend() will
not always resolve.

Much better to do something like this:

// check we can get to the element and that it has the EI method we want
available
var obj = document.getElementById("flashContent");
if (obj && typeof obj.callExtFunction != "undefined") {
obj.callExtFunction();
}


Cheers,
Aran





On Sat, Aug 22, 2009 at 10:16 AM, Sam Sherlock <[email protected]>wrote:

> you currently have two elements with the same id, not the end of the world
> but swfObject can help you in the case you can use the attribs param when
> calling embedSwf
> so you can target a div with one id and place a swf with another also you
> can set the class too in this object (after the params object when calling
> embedSwf) - you could also write a notice to the div if the player version
> is incorrect
> sidenote: checkout ie collections (if you have'nt already)
>
> - S
>
>
>  2009/8/21 ifl <[email protected]>
>
>>
>>  i'm still in desbelief that i got this to work.
>> i can't see what i did, but i got it to work both in FF and IE7
>> i must install an test in other IE's but for now, im in disbelief
>> until i re test the code tomorrow (usaully something breaks after a
>> few hours when stubles like this occur, so..)
>>
>> in the meanwhile here's the code if anybody else is interested in
>> testing or even using the code
>>
>> used with dynamic publishing
>> (also has a javascript disabled backup script to run flash)
>> ...
>>
>>
>> <!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" xml:lang="en" lang="en">
>>
>> <head>
>> <title>Dynamic</title>
>>
>> <style type="text/css">
>> body, html {
>> height: 100%;
>> margin: 0;
>> background-color:#e1e6e9;
>> }
>> </style>
>>
>> <!-- Embed Flash with SWFObject 2 - Start-->
>> <script type="text/javascript" src="js/swfobject.js"></script>
>>
>> <script type="text/javascript">
>>
>>        var params = {};
>>        params.bgcolor = "#e1e6e9";
>>        params.menu = "false";
>>        params.quality = "best";
>>        params.scale = "noscale";
>>
>>        swfobject.embedSWF("ExternalInterfaceExample.swf", "flashContent",
>> "550", "400", "9.0.0", "swfTools/expressInstall.swf", false, params,
>> false);
>> </script>
>>
>>
>> <!-- Javascript Detection Script Snippet -->
>> <style type="text/css">
>> .hide { visibility:hidden; }
>> .show { visibility:visible; }
>> </style>
>>
>>
>> <!-- Event Link - Makes JS call the flash function  -->
>> <script type="text/javascript">
>> function formSend() {
>>        document.flashContent.callExtFunction();
>> }
>> </script>
>>
>> <!-- Check For The Variable 'events' in URL -->
>> <script type="text/javascript">
>> function checkEventString() {
>>        if(location.search != "") {
>>                var findString = "events";
>>                var windowHref = document.location.href;
>>                if(windowHref.search(findString) != -1) {
>>                        formSend();
>>                }
>>        }
>> }
>> </script>
>>
>>
>> </head>
>> <body onload="checkEventString();">
>>
>> <div id="flashContent" class="hide"></div>
>>
>> <script type="text/javascript">
>> document.getElementById('flashContent').className='show';
>> document.getElementById('flashContent').innerHTML="<strong>In order to
>> view this website you need to install the <a href='http://
>> www.adobe.com/go/getflashplayer' target='_blank'>Flash Player</a> 9+</
>> strong>";
>> </script>
>>
>> <noscript>
>> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
>> width="550" height="400" id="flashContent" >
>>        <param name="allowScriptAccess" value="sameDomain" />
>>        <param name="allowFullScreen" value="false" />
>>        <param name="movie" value="ExternalInterfaceExample.swf" />
>>        <param name="quality" value="best" />
>>        <param name="bgcolor" value="#e1e6e9" />
>>        <param name="scale" value="noscale" />
>>        <embed src="ExternalInterfaceExample.swf" quality="best"
>> scale="noscale" bgcolor="#e1e6e9" width="550" height="400"
>> name="ExternalInterfaceExample" allowScriptAccess="always"
>> allowFullScreen="false" type="application/x-shockwave-flash"
>> pluginspage="http://www.macromedia.com/go/getflashplayer"; />
>> </object>
>> </noscript>
>> </body>
>> </html>
>>
>> enjoy
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SWFObject" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/swfobject?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to