sendingDomain=="store.domain.com");
}
Also, for files authored for Flash Player 7 or later, you can't use this method to let SWF files
hosted using a secure protocol (HTTPS) allow access from SWF files hosted in nonsecure
protocols; you must use the
Occasionally, you might encounter the following situation. Suppose you load a child SWF file
from a different domain. You want to implement this method so that the child SWF file can
make LocalConnection calls to the parent SWF file, but you don't know the final domain from
which the child SWF file will come. This can happen, for example, when you use load-balancing
redirects or third-party servers.
In this situation, you can use the
method. For example, if you load a SWF file into
checking whether the domain argument matches the domain of
domain out of the full URL contained in
If you do this, make sure that you wait until the SWF file in
property will not have its final, correct value until the file is completely loaded. The best way to
determine when a child SWF file finishes loading is to use MovieClipLoader.onLoadComplete.
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.
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.
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()
method in the receiving SWF file. For a discussion of the use of the underscore (_) in
trace()
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");
404
Chapter 2: ActionScript Language Reference
LocalConnection.allowInsecureDomain
MovieClip._url
Again, you must parse the domain out of the full URL from
, in which only SWF files from the same domain can invoke the
LocalConnection.send()
property in your implementation of this
, you can then implement this method by
my_mc
my_mc._url
.)
my_mc._url
my_mc
.
event handler instead.
. (You must parse the
is loaded, because the
_parent._url
_url
. In
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?