LocalConnection.domain( ) Method | Flash 6 |
returns a string indicating the movie's subdomain |
The movie's subdomain, as a string.
The domain( ) method simply returns the so-called subdomain of the current movie, as a string. For one- and two-component domain names, such as apollo and oreilly.com, the subdomain is identical to the complete domain. For domain names with three or more components, such as www.moock.org or events.news.thedailybugle.com, the subdomain is defined as everything after the first dot, in this case "moock.org" and "news.thedailybugle.com". For movies running on the local filesystem, domain( ) returns "localhost". The subdomain is used for a variety of security checks in the Flash Player, including LoadVars and XML network communication.
The domain( ) method is used by LocalConnection objects communicating across domains. It lets us specify the subdomain of a sender or receiver movie without knowing its name beforehand. For example, the following code allows messages from a sender at either oreilly.com or the same domain as the receiver (whatever that domain happens to be):
receiveConn.allowDomain = function (domain) { return domain = = "oreilly.com" || domain = = this.domain(); }
LocalConnection.allowDomain( ), LocalConnection.send( ), MovieClip._url, System.security.allowDomain( )