LocationUtil

Kind of class:class
Inherits from:none
Version:02/13/07
Author:Aaron Clinger
Classpath:org.casalib.util.LocationUtil
File last modified:Monday, 01 December 2008, 13:34:40
Util functions for detecting SWF's file location.

Summary


Class methods
  • isWeb (location:MovieClip) : Boolean
    • Determines if the SWF is being served on the internet.
  • isPlugin : Boolean
    • Determines if the SWF is running in a browser plug-in.
  • isIde : Boolean
    • Determines if the SWF is running in the IDE.
  • isStandAlone : Boolean
    • Determines if the SWF is running in the StandAlone player.
  • isDomain (location:MovieClip, domain:String) : Boolean
    • Detects if MovieClip's embed location matches passed domain.
  • getDomain (location:MovieClip) : String
    • Detects MovieClip's domain location.

Class methods

getDomain

static function getDomain (
location:MovieClip) : String

Detects MovieClip's domain location.
Parameters:
location:
MovieClip to get location of.
Returns:
  • Returns full domain (including sub-domains) of MovieClip's location.
Usage:
  • trace(LocationUtil.getDomain(_root));
Usage note:
  • Function does not return folder path or file name. The method also treats "www" and sans "www" as the same; if "www" is present method does not return it.

isDomain

static function isDomain (
location:MovieClip, domain:String) : Boolean

Detects if MovieClip's embed location matches passed domain.
Parameters:
location:
MovieClip to compare location of.
domain :
Web domain.
Returns:
  • Returns true if file's embed location matched passed domain; otherwise false.
Usage:
  • To check for domain:
    trace(LocationUtil.isDomain(_root, "google.com"));
    trace(LocationUtil.isDomain(_root, "bbc.co.uk"));

    You can even check for subdomains:
    trace(LocationUtil.isDomain(_root, "subdomain.aaronclinger.com"))

isIde

static function isIde (
) : Boolean

Determines if the SWF is running in the IDE.
Returns:
  • Returns true if SWF is running in the Flash Player version used by the external player or test movie mode; otherwise false.

isPlugin

static function isPlugin (
) : Boolean

Determines if the SWF is running in a browser plug-in.
Returns:
  • Returns true if SWF is running in the Flash Player browser plug-in; otherwise false.

isStandAlone

static function isStandAlone (
) : Boolean

Determines if the SWF is running in the StandAlone player.
Returns:
  • Returns true if SWF is running in the Flash StandAlone Player; otherwise false.

isWeb

static function isWeb (
location:MovieClip) : Boolean

Determines if the SWF is being served on the internet.
Parameters:
location:
MovieClip to get location of.
Returns:
  • Returns true if SWF is being served on the internet; otherwise false.
Usage:
  • trace(LocationUtil.isWeb(_root));