• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ArgumentError: Error #2082: Connect failed because the object is already connected.

Guest
Jan 22, 2009 Jan 22, 2009

Copy link to clipboard

Copied

Hello people,
I have seen a few posts on this topic and I have tried wrapping the lc.connect attempt in a try/catch block.

My goal is to be able to open my app (a cfm in which multiple swf's communicate w/ each other using localConnection) in multiple browsers without receiving this error.
Thanks!
gb
TOPICS
ActionScript

Views

6.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 23, 2009 Jan 23, 2009

Copy link to clipboard

Copied

Maybe you can use this reference: http://www.brianwiltshire.net/lab/?p=96

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 24, 2009 Jan 24, 2009

Copy link to clipboard

Copied

Each LocalConnection needs a unique name. Generate a unique identifier for the name.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 26, 2009 Jan 26, 2009

Copy link to clipboard

Copied

Hey guys,
Thanks for responding!

LuigiL - Do you mean when you create the connection (var thumbsConnect:LocalConnection = new LocalConnection)? I have done that much. The problem happens when I open the same application in two different browsers - connections of the same name stepping on eachothers' toes even though I have each connection named specifically to match it's function. ie, thumbsConnect, slideConnect, etc. Is that what you mean or are you referring to something else?

I wonder if I could name it a random number each time it runs, then send that number to the url and have the receiving swf pick up the new unique random name from the address bar?? - just a stab in the dark...

Thanks!
-gb

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2009 Jan 26, 2009

Copy link to clipboard

Copied

there's a problem with localconnection working correctly in non-ie browsers, when ie is running the swfs that contain those localconnections is open.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 26, 2009 Jan 26, 2009

Copy link to clipboard

Copied

Any word on a workaround?
Thanks,
gb

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2009 Jan 26, 2009

Copy link to clipboard

Copied

not that i know about.

why would you have 2 different browsers open at the same time unless you're testing?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 27, 2009 Jan 27, 2009

Copy link to clipboard

Copied

The boss doesn't want any errors to come up ever.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2009 Jan 27, 2009

Copy link to clipboard

Copied

i understand that but there's no reason to test in two browsers simultaneously. test sequentially to obviate the problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 25, 2009 Aug 25, 2009

Copy link to clipboard

Copied

Hi all, I have a solution but I would like to hear some comments about it:

I have a flash player 8 swf movie (as2)  that needs to be loaded controlled and communicated by a flash player 9-10 (as3).

This was a nightmare for me until I solved it out with local connection. (AVM1 to AVM2 connection and viceversa).

Now local connection had to be established both on the AS2 and the AS3 movies.

I ran into the same problems everyone here are describing :

Error #2082: Connect failed because the object is already connected

Usually because several browsers were open the same time, and even several tabs in the same browsers.

What I did is as follows:

first an outline of the process:

1. load external movie with a query cache killer string :myMovie.swf?ck=1894677

2. on the loaded external movie get the querystring.

3. open local connection key in both movies - that has the key name of the querystring.

4. I had to create 2 connections (viceversa) so I made one key = querystring , the other = querystring+"_out"

5. BOOOM IT WORKS!!! - since each browser page has a different local connection key - there are no conflicts.

6. Tested with Firefox 3.5 at 2 tabs opened with the same site, two tabs of IE7, one chrome, one opera - all open at the same time!!!!!!

--------------------

for the long explanation (this is not the entire code - just snippets .. so use this wisely)

I usually add a cache killer to my external loaded movies (  a string that changes the name of the downloaded swf file so it will not be cached by the
browser - and by that I am getting a fresh copy of the file , every time).

So instead of loading: myMovie.swf , I load myMovie.swf?ck=1894677 for example.

this can be done like this:

in the main as3 movie:

             var AVM_lc:LocalConnection = new LocalConnection();
             var AVM_listener:LocalConnection ;
             var myClient:Object;
             var randomLCname:String;
             var randomLCnameOutgoing:String;

                randomLCname = String(getTimer()) + String(Math.round(Math.random() * 10000));

                randomLCnameOutgoing = randomLCname + "_out";

                theMoviePath = "externalAs2movie.swf?ck="+randomLCname;

                var movRequest:URLRequest = new URLRequest(theMoviePath)
                movLoader.load(movRequest);

after the movie is loaded I create two local connections to the as2 movie:

          //incoming

            AVM_listener = new LocalConnection();
            myClient = new Object();
            AVM_listener.client = myClient;

            myClient.gotoProjects = function () {
                // a function to execute once I get a note from the as2 external loaded movie
                };
            try {

                AVM_listener.connect(randomLCname);
            } catch (error:ArgumentError) {
                w(error.toString())
            }

          // outgoing whenever I want I do:

          AVM_lc.send(randomLCnameOutgoing, "playAnime");

          //or

          AVM_lc.send(randomLCnameOutgoing, "resetAnime");

now in the loaded movie (for this example it is an as2 movie - but can be done on an AS3 movie as well, at least I think so...)

I am reading the querystring (it is different in as3.....):

in the external as2 that is loaded into the as3:

var avm1toavm2:String = _root.ck; // do not forget the _root in as2
var avm2toavm1:String = avm1toavm2+"_out";

// local connection instance to receive events
var AVM_lc:LocalConnection = new LocalConnection();

// stopAnimation event handler - a command to stop the animation - inside the as2 external movie
AVM_lc.stopAnimation = function(){
    stop();
}

//etc.
AVM_lc.resetAnime = function(){
    gotoAndStop(1);
}
AVM_lc.playAnime = function(){
    gotoAndPlay(1);
}

// listen for events for "AVM2toAVM1" - it means from the as3 file to this as2 file
AVM_lc.connect(avm2toavm1); // avm2toavm1 this parameter was defined earlier in this code

//--------------- create a connection to comunicate with the as3 movie
var sendToAs3:LocalConnection = new LocalConnection();

function movieIsOver(){ // this is a function that will be executed when the as2 movie is over
    sendToAs3.send(avm1toavm2, "gotoProjects");
}
stop();

-------------------------- complicated but works!!!!!

Can anyone comment?

Can I have hundreds of localConnections the same time (assuming I did not close the others, while shuting the browser?????)

Gidon

Koomkoom Multimedia

info@koomkoom.com

site:

www.koomkoom.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2017 Aug 16, 2017

Copy link to clipboard

Copied

I have the same problem with Windows AIR application. Also this issue appears after system awake from hibernation.

Steps to reproduce:

1) Connect to a LocalConnection.

2) Hibernate your Windows device and then wake it.

Result: LocalConnection works no more. You need to reboot device.

Adobe, please fix this issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 16, 2017 Aug 16, 2017

Copy link to clipboard

Copied

LATEST

OMG, can't even believe I wrote my comment 8 years ago.

FLASH IS DEAD.

I've moved on...

Gidon

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines