<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; URLUtil</title>
	<atom:link href="http://blog.flexexamples.com/category/urlutil/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Determining which server/domain a SWF is hosted on</title>
		<link>http://blog.flexexamples.com/2007/08/09/determining-which-serverdomain-a-swf-is-hosted-on/</link>
		<comments>http://blog.flexexamples.com/2007/08/09/determining-which-serverdomain-a-swf-is-hosted-on/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 05:12:08 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[URLUtil]]></category>
		<category><![CDATA[getServerName()]]></category>
		<category><![CDATA[loaderInfo]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/09/determining-which-serverdomain-a-swf-is-hosted-on/</guid>
		<description><![CDATA[<p>Here&#8217;s a handy tip which can help you when deploying Flex applications on mulitple servers (such as a staging/production server). Basically you can listen for the Application tag to dispatch the applicationComplete event, grab the URL of the SWF using the loaderInfo.url property, and then use the URLUtil.getServerName() method to parse out the server name.</p> [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a handy tip which can help you when deploying Flex applications on mulitple servers (such as a staging/production server). Basically you can listen for the Application tag to dispatch the <code>applicationComplete</code> event, grab the URL of the SWF using the <code>loaderInfo.url</code> property, and then use the <code>URLUtil.getServerName()</code> method to parse out the server name.</p>
<p>Full code after the jump.</p>
<p><span id="more-73"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2007/08/09/determining-which-serverdomain-a-swf-is-hosted-on/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;vertical&quot;</span> applicationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.utils.URLUtil;</span>
&nbsp;
<span style="color: #339933;">            private function init():void {</span>
<span style="color: #339933;">                lbl.text = &quot;url=&quot; + URLUtil.getServerName(Application.application.loaderInfo.url);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;lbl&quot;</span> text=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Application_loaderInfo_url_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Application_loaderInfo_url_test/bin/main.html" width="100%" height="80"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Determining which server/domain a SWF is hosted on on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/09/determining-which-serverdomain-a-swf-is-hosted-on/',contentID: 'post-73',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'getServerName(),loaderInfo,url,URLUtil',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/08/09/determining-which-serverdomain-a-swf-is-hosted-on/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

