Development Flex



    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="getHostName()">
    
        
    

    
         
        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/" 
            } 
        }