close (LocalConnection.close method)

public close() : Void

Closes (disconnects) a LocalConnection object. Issue this command when you no longer want the object to accept commands--for example, when you want to issue a LocalConnection.connect() command using the same connectionName parameter in another SWF file.

Availability: ActionScript 1.0; Flash Player 6

Example

The following example closes a connection called receiving_lc when you click a Button component instance called close_button:

this.createTextField("welcome_txt", this.getNextHighestDepth(), 10, 10, 100, 22);
this.createTextField("status_txt", this.getNextHighestDepth(), 10, 42, 100,44);

var receiving_lc:LocalConnection = new LocalConnection();
receiving_lc.sayHello = function(name:String) {
    welcome_txt.text = "Hello, "+name;
};
receiving_lc.connect("lc_name");
var closeListener:Object = new Object();
closeListener.click = function(evt:Object) {
    receiving_lc.close();
    status_txt.text = "connection closed";
};
close_button.addEventListener("click", closeListener);

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components' DepthManager class instead of the MovieClip.getNextHighestDepth() method.

See also

connect (LocalConnection.connect method)