Mega Code Archive
Gets the SWF files URL and extracts the host name from the URL
import mx.core.FlexGlobals;
[Bindable]
public var g_HostString:String;
[Bindable]
public var g_ContextRoot:String;
[Bindable]
public var g_BaseURL:String;
private function getHostName():void {
g_BaseURL = FlexGlobals.topLevelApplication.url;
var pattern1:RegExp = new RegExp("http://[^/]*/");
if (pattern1.test(g_BaseURL) == true) {
g_HostString = pattern1.exec(g_BaseURL).toString();
} else{
g_HostString = "http://localhost/"
}
}