View Full Version : Localconnection IE only?
Tankshell
02-14-2005, 01:35 AM
Hi guys, Im using Localconnection on a new site I'm developing so that multiple seperate Flash movies can talk to each other. I have it working perfect in Internet Explorer....
I just tried running it in Netscape 7.2, Firefox 1.0 and Opera 7 and it does not work in any of them!
Pleeeeeaaaaas tell me that Localconnection is not an IE only Flash thing!! My entire site concept depends on communication between movies!
HELP!
nunomira
02-14-2005, 02:44 AM
Hi,
I assure you it does work in Firefox because I've used it a lot, but I'm afraid I don't have an explanation of why it wouldn't work for you.
Furthermore the LocalConnection Class works between different players, e.g.: IE + Firefox, or a browser + projector, etc...
Tankshell
02-14-2005, 11:47 AM
Hi,
I have solved the problem. Being a developer I always have multiple different browsers open all at the same time so that I can quickly test a page is working in a particular browser.
This is what causes the problem. If you are looking at a localconnection flash movie in say Internet Explorer it will work fine. If you then open up say Netscape or Firefox while Internet Explorer is still running, the localconnection WILL NOT WORK in the newly opened browser. It will however still work in the first browser you had open, in this case Internet Explorer...
If you close down the first browser you had open, the localconnection will start to work in a different browser etc etc.
Basically, Flash gets confused if you have different browsers looking at the same localconnection flash movie at the same time.
If you open them all up one after another, making sure to close all instances of a particular browser after viewing the flash movie it will work fine in any browser.
So, how to solve this problem (not that it really is a huge problem but nevertheless!), I think the problem is basically due to the same localconnection name being used at the same time across many different browsers. In order to solve this I propose that every time you load a flash movie that uses localconnection, you need to have a randomly, or uniquely generated name...across the whole page obviously! PHP or any other type of server side scripting would make this easy, simply generate a unique value (a timestamp will never repeat for example) and send it to any flash movies that use localconnection on that page...make sure that the object names etc use this unique value somewhere in their names. Everytime you load the page in a browser now, the localconnection will have a different name...hopefully meaning that the issues mentioned above will disappear!
I will try this out tonight and let you know if it works!
Tankshell
02-14-2005, 01:01 PM
Ok I have quickly tried this out and have it working like a charm! It's so sweet!
First, the php page >
<?
$unique_Flash_Localconnection_Name = mktime ();
?>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="790" height="230" id="page_top" align="middle">
<param name="FlashVars" value="uniqueName=<?=$unique_Flash_Localconnection_Name?>">
<param name="movie" value="flash/panel_main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="flash/panel_main.swf" FlashVars="uniqueName=<?=$unique_Flash_Localconnection_Name?>" quality="high" bgcolor="#ffffff" width="790" height="230" name="page_top" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="790" height="150" id="panel_settings" align="middle">
<param name="FlashVars" value="uniqueName=<?=$unique_Flash_Localconnection_Name?>">
<param name="movie" value="flash/panel_settings.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="flash/panel_settings.swf" FlashVars="uniqueName=<?=$unique_Flash_Localconnection_Name?>" quality="high" bgcolor="#ffffff" width="790" height="150" name="panel_settings" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
Then in the listener Flash movie >
this["recieving_lc"] = "recieving_lc"+uniqueName;
this["lc_name"] = "lc_name"+uniqueName;
recieving_lc = new LocalConnection();
recieving_lc.closePanel = function() {
_root.gotoAndPlay ("Close Panel");
};
recieving_lc.connect(lc_name);
Then in the sending Flash movie >
this["sending_lc"] = "sending_lc"+uniqueName;
this["lc_name"] = "lc_name"+uniqueName;
sending_lc = new LocalConnection();
sending_lc.send(lc_name, "closePanel");
Viola! This means that the localconnection will now work on all browsers ALL AT THE SAME TIME no matter how many or what type you have open! Because eveytime you load up the page the localconnection instance has a unique name! Great!
I will knock up an exmaple file tonight and upload it to my site and put a link in this thread with source files to download!
Cheers!
UncleML
02-16-2005, 02:28 AM
Thanks for the tip. It's helpful.
Lane4
03-15-2005, 06:34 PM
Thanks for the tip. BTW: you could also do this with JavaScript if you want to do the processing on the client side. Thanks again.
lokeypod
01-16-2006, 08:42 PM
Tankshell, that's messed up! I was trying that very thing and getting frustrated with it until I found your thread. Thank you!
PS: I'm new here, so hopefully I can reciprocate in some way. Although my AS skills are not the sharpest, but I am a good animator.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.