MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 715

Actionscript 2.0 language reference
Table of Contents

Advertisement

The opposite situation can also occur: You might create a child SWF file that wants to accept
LocalConnection calls from its parent but doesn't know the domain of its parent. In this
situation, implement this method by checking whether the domain argument matches the
domain of _parent._url. Again, you must parse the domain out of the full URL from
_parent._url. In this situation, you don't have to wait for the parent SWF file to load; the
parent will already be loaded by the time the child loads.
Availability: ActionScript 1.0; Flash Player 7
Parameters
sendingDomain:String
contains the sending LocalConnection object.
Example
The following example shows how a LocalConnection object in a receiving SWF file can
permit SWF files from any domain to invoke its methods. Compare this to the example in
LocalConnection.connect()
the
method in the receiving SWF file. For a discussion of the use of the underscore
trace()
(_) in the connection name, see
this.createTextField("welcome_txt", this.getNextHighestDepth(), 10, 10,
100, 20);
var my_lc:LocalConnection = new LocalConnection();
my_lc.allowDomain = function(sendingDomain:String) {
domain_txt.text = sendingDomain;
return true;
};
my_lc.allowInsecureDomain = function(sendingDomain:String) {
return (sendingDomain == this.domain());
}
my_lc.sayHello = function(name:String) {
welcome_txt.text = "Hello, "+name;
};
my_lc.connect("_mylc");
The following example sends a string to the previous SWF file and displays a status message
about whether the local connection was able to connect to the file. A TextInput component
called
, a TextArea instance called
name_ti
are used to display content.
send_button
var sending_lc:LocalConnection;
var sendListener:Object = new Object();
sendListener.click = function(evt:Object) {
sending_lc = new LocalConnection();
sending_lc.onStatus = function(infoObject:Object) {
switch (infoObject.level) {
[optional] - A string that specifies the domain of the SWF file that
, in which only SWF files from the same domain can invoke
LocalConnection.send()
status_ta
.
and a Button instance called
LocalConnection
715

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF