Copy link to clipboard
Copied
I have a set of static string variables that hold the url location of modules in a project. These locations change depending on whether I'm building for development, staging or production.
What's the best way to set static variables in this way?
Copy link to clipboard
Copied
I don't know if this is best practice, but here's the solution I've come up with.
The root domain is accessible within the swf via a node on a loaded xml file. So I created a simple method that sets a url variable based on that domain node.
The domain-based url variable is then used within the static string variables that define the location of the modules.
Simplified like so:
var domain:String = xml.node.value;
static var bucketLocation:String = getLocation()
static var moduleLocation:String = bucketLocation + "modulename.swf";
function getLocation():String
{
var loc:String
switch (domain) {
case stagingUrl:
loc = "pathToAmazonStagingBucket";
break;
case productionUrl:
loc = "pathToAmazonProductionBucket";
break;
}
}