Я не верю, что есть, но я думаю, что вы все равно можете форсировать закрытие.
Не совсем уверен, насколько это будет просто, но я бы предпочел это. При создании экземпляра LocalConnection обязательно включите его в клиент (или как свойство в AS2):
function close()
{
myConnection.close();
}
В дополнение к этому, я хотел бы включить это при попытке установить соединение:
var commName:String = "MY_CONNECTION";
var myConnection:LocalConnection = new LocalConnection();
// Try to tell any open LocalConnection on this channel to close.
// This may cause an AsyncErrorEvent, so be sure to add the appropriate
// Error handling.
myConnection.send( commName, "close" );
try
{
myConnection.connect( commName );
}
catch( error:Error )
{
// If there is another connection already open on the same channel,
// that will cause an Error. I have had some luck catching that
// Error and then calling connect again. That said, you would be
// best to take precautions anyway.
try
{
myConnection.connect( commName );
}
catch( error:Error )
{
// Your connection cannot connect!!!
// DO SOMETHING!!!
}
}
myConnection.client = this;