I'm too new at Flex to do anything fancy like reading files from the O/S
file system, so I use the Project compile option.
-locale en_US -define=CONFIG::debug,true
Then I have me some constants:
public static const DEBUGMODE:Boolean = CONFIG::debug;
public static const DEBUG_BASEURL:String = "http://localhost/foo/"
public static const RELEASE_BASEURL:String =
"http://www.somedomain.com/foo";
And then in my wrapper for the HTTPService:
if ( SearchConstants.DEBUGMODE) {
baseURL = SearchConstants.DEBUG_BASEURL ;
}else{
baseURL= SearchConstants.RELEASE_BASEURL ;
}
All you have to do is change the compiler settings to "debug, false" and
-- voilĂ -- or wa-la if you like that better. There's still the
"forgetting to change the compiler options" issue, but it's probably a
good habit to examine the Compiler options before each compile, and this
approach inculcates a good habit.
Take this with a grain of salt; I'm new to Flex; my expertise, if I have
any at all, is not in Flex programming.
Regards
Tim Romano
On 2/21/2010 8:00 PM, David Adams wrote:
I've been writing some small programs that use HTTPService calls to
fetch data from a back-end. During testing, I'm using 127.0.0.1 or an
IP address on my subnet. When I deploy, I update the IP address in
service definitions to the right external address and build the app.
Or at least I mean to. It's all too easy to accidentally change the
addresses for internal testing and then forget to switch them back
before building.
Is there a best practice or simple strategy for putting the IP address
somewhere outside of the source code that it can easily be edited
without a rebuild?
Thanks for any advice.
__