I found a solution that appears to work. I had the same problem. A
simple localConnection call worked fine with standard embed code, but
stopped working when I used SWFObject (v1.5).
Instead of defining the localConnection name inside the flash, pass it
in as a flashvar using SWFObject and then things are fine.
OLD FLASH CODE:
// Code in the sending movie
sendingLC = new LocalConnection();
sendingLC.send("lc_arrow", "startArrow");
// Code in the receiving movie
receivingLC = new LocalConnection();
receivingLC.startArrow = function() {
_root.arrow.gotoAndPlay(2);
};
receivingLC.connect("lc_arrow");
NEW FLASH CODE:
// Code in the sending movie
sendingLC = new LocalConnection();
sendingLC.send(lc_name == undefined ? "lc_arrow" :
lc_name,"startArrow");
// Code in the receiving movie
receivingLC = new LocalConnection();
receivingLC.startArrow = function() {
_root.arrow.gotoAndPlay(2);
};
receivingLC.connect(lc_name == undefined ? "lc_arrow" : lc_name);
And then add this line to your SWFObject code:
so.addVariable("lc_name", "lc_arrow");
I have no idea why it works, but it does.
On Feb 18, 3:02 pm, mnkyhead <[email protected]> wrote:
> I have a html page where I need to have two swf's one on top of the
> other. I am using z-index and absolute positioning of divs that
> contain my swf's. These swf's talk through localConnection.
> currently I am using a standard embed code to put the swf's on the
> page. If I try and use swfObject, the localConnection fails to
> connect.
>
> here is my code without SWFObject
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
> <head>
> <title></title>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1" />
> <style type="text/css">
> *{padding:0; margin:0;}
> .x
> {
> position:absolute;
> left:0px;
> top:0px;
> z-index: -1;
> }
> .y
> {
> position:absolute;
> left:0px;
> top:0px;
>
> }
> </style>
>
> <script language="javascript">
> function moveBack()
> {
>
> document.getElementById('shellDiv').style.zIndex = -1;
> }
>
> function moveUp()
> {
>
> document.getElementById('shellDiv').style.zIndex = 10;
> }
> </script>
>
> </head>
> <body>
> <div id="baseDiv" class="y">
> <object width="1024" height="768">
> <param name="movie" value="newWin.swf">
> <param name="wmode" value="opaque"/>
> <embed src="newWin.swf" width="1024" height="768"
> wmode="opaque"/>
> </object>
> </div>
> <div id="shellDiv" class="x">
> <object width="1024" height="768">
> <param name="movie" value="PetHealthShell.swf"/>
> <param name="wmode" value="transparent"/>
> <embed src="PetHealthShell.swf" width="1024" height="768"
> wmode="transparent"/>
> </object>
> </div>
> </body>
> </html>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---