Then you should probably stick to the mx.core.Application implementation and
use mx.utils.URLUtil to extract the bits as follows:

Var fullURL:String = Application.application.url;
Var baseURL:String = fullURL.substring( 0, fullURL.indexOf( "/",
fullURL.indexOf( URLUtil.getServerName( fullURL ) ) ) );
Var protocol:String = URLUtil.getProtocol( fullURL );
Var port:uint = URLUtil.getPort( fullURL );
Var serverName:String = URLUtil.getServerName( fullURL );
Var isSecure:Boolean = URLUtil.isHttpsURL( fullURL );

This is from memory - so... I'm not sure if this will copy/paste. Just
remember that the Application.application.url is going to report the URL to
the application .swf file - and not the path to the _page_ that loads/hosts
your .swf. As long as you aren't getting creative with where your .swf files
live you shouldn't have any problems with this approach.

Just an fyi - the BrowserManager is primarily used with deep linking and
exposes fragments for internal application navigation. Give that example one
more go - launch it... then in the address bar type in a #foo (exclude the #
if one is already there) at the very end of the url (i.e.
http://www.bar.com/myapp.html#foo).

AND PREPARE TO WET YOUR PANTS!

Rick Winscot



From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of shivkxr
Sent: Tuesday, March 25, 2008 8:31 PM
To: [email protected]
Subject: [flexcoders] Re: Get the Domain the Flex app is running in

--- In [email protected], "Rick Winscot" <[EMAIL PROTECTED]> 
wrote:
>
> You might want to give BrowserManager a go… or mx.utils.URLUtil.
> 
> URLUtil includes functions like
> 
> * getFullURL():String
> * getPort():uint
> * WhosYourDaddy():Daddy
> * getServerName():String

Rick,

I've already tried BrowserManager. It doesn't do the job, in fact I 
can't image how or where one could use it, because it seems the url has 
to change while the FLASH/Flex app is still alive and I've not been 
able to create such a case. I even tried the sample in the docs and it 
doesn't work. I mean it runs ok, but the properties are all null.
 


Reply via email to