May 4
I recently came across this very handy tip from a Flex Examples Blog.
This code sample allows any Flex developer to determine the server / domain name at runtime. This is 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.
I ended up using this excellent solution for a Flex project I'm working on as a consultant. Check it out:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical" applicationComplete="init()"> <mx:Script> <![CDATA[ import mx.utils.URLUtil; private function init():void { lbl.text = "url=" +
URLUtil.getServerName(Application.application.loaderInfo.url); } ]]> </mx:Script> <mx:Label id="lbl" text="" /> </mx:Application>
7-8-2008
6-3-2008
5-4-2008
5-4-2008
5-2-2008