forked from as3/as3-utils
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathisDomain.as
More file actions
27 lines (24 loc) · 795 Bytes
/
isDomain.as
File metadata and controls
27 lines (24 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package utils.location {
import flash.display.DisplayObject;
/**
* Detects if MovieClip embed location matches passed domain.
* Check for domain:
* <pre>
* trace(isDomain(_root, "google.com"));
* trace(isDomain(_root, "bbc.co.uk"));
* </pre>
* You can even check for subdomains:
* <pre>
* trace(isDomain(_root, "subdomain.aaronclinger.com"))
* </pre>
* @param location MovieClip to compare location of
* @param domain Web domain
* @return true if file's embed location matched passed domain
* @author Aaron Clinger
* @author Shane McCartney
* @author David Nelson
*/
public function isDomain(location:DisplayObject, domain:String):Boolean {
return getDomain(location).slice(-domain.length) == domain;
}
}