I am trying to close() localconnection when connect() fails. But while closing connection it giving me '#2083 close failed because object is not connected'.
Thanks in advance.
try{
connServer2Client.connect("_" + clientConnectionName);
}catch (error:ArgumentError) {
trace("in catch connection established");
connServer2Client.close();
connServer2Client.connect("_" + clientConnectionName);
}
Adobe really screwed this one up IMO.
There should be a parameter to check or a function to call, which tells you the status. I.E.
But there is not. So the best solution is multiple try catch functions which is terrible! Here is the class I use. I use flex with html/javascript so this is in javascript but you can do something similar in as3.
So the connected will help tell you if you have a LocalConnection.