wrote this a while back.... should help ya out.

can use it like this:   var serverName = URLUtil.instance.getServerName();

class URLUtil
{
    private static var _instance:core.utils.URLUtil;
    private var urlElementsArray:Array;
   
    private function URLUtil()
    {
        var s:String = mx.core.Application.application._url;
        urlElementsArray = s.split("/");
    }
   
    public static function get instance():core.utils.URLUtil
    {
        if(_instance == undefined){_instance = new URLUtil;}
        return _instance;
    }
   
    public function getServerName():String
    {
        var s:String = urlElementsArray[2];
        var temp:Array = s.split(":");
        return temp[0];
    }
   
    public function getPortNumber():Number
    {
        var s:String = urlElementsArray[2];
        var temp:Array = s.split(":");
        if(temp.length = 1){return 80;}else{return temp[1];}
    }
   
    public function getFullPath():String
    {
        var tmpArray:Array = urlElementsArray.slice(0, urlElementsArray.length - 1);
        return tmpArray.join("/");
    }
}

On 7/29/05, pb_test <[EMAIL PROTECTED]> wrote:
Hi,

I need to get the server name of where the SWF is served.
For example: if the flex client is servered from
http://www.macromedia.com/flex/, I need to get http://www.macromedia.com/


Thanks,





------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a href="" href="http://us.ard.yahoo.com/SIG=12h55hlhq/M=362329.6886308.7839368.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1122672241/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992"> http://us.ard.yahoo.com/SIG=12h55hlhq/M=362329.6886308.7839368.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1122672241/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~->

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to