LocalConnection.domain( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
LocalConnection.domain( ) Method Flash 6

returns a string indicating the movie's subdomain
localConn.domain()

Returns

The movie's subdomain, as a string.

Description

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(); }

See Also

LocalConnection.allowDomain( ), LocalConnection.send( ), MovieClip._url, System.security.allowDomain( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net