> Is is possible to update all the variables that are affected by a change to 
> the affiliate?

If you make them static getters rather than static vars,  they can return 
something different every time you access them.

Gordon Smith
Adobe Flex SDK Team

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Joshua
Sent: Monday, May 10, 2010 2:01 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Updating Static vars



Hello.... I've got a situation as follows

1. I have a class called MessageStrings.as that I use for storing static consts 
and variables used throughout my project.

2. Recently, we started an affiliate program where I need to make modifications 
to the MessageStrings to change company names, email addresses, etc depending 
on which affiliate is loading the page (from url string)

3. Instead of copying a bunch of static vars like
public static var CONTACT_US:String = "Hello, contact us by phone at: "+PHONE;
public static var CONTACT_US_AFFILIATE:String = "Hello, contact us by phone at: 
"+PHONE_AFFILIATE;

and switching all the references I have to MessageStrings for affiliate info I 
would like to do

public static var CONTACT_US:String = "Hello, contact us by phone at: 
"+getPhone();

and have a new variable (static var) called THE_AFFILIATE that gets set by a 
static function and getPhone returns a static var depending on what 
THE_AFFILIATE is set to.

where getPhone is something like this....

public static function getPhone():String {
var retPhone:String = "";
switch (THE_AFFILIATE) {
case MY_BUSINESS:
retPhone = SUPPORT_PHONE;
break;
case AFFILIATE:
retPhone = SUPPORT_PHONE_AFFILIATE;
break;
}
return retPhone;
}

So, this almost works, problem is that the class (MessageStrings) sets all the 
variables intially and then when I set the Affiliate info later, the static 
vars are not updated, and therefore do not reflect the text I want to see.

Is is possible to update all the variables that are affected by a change to the 
affiliate? Kinda like calling the constructor again, but that won't work cause 
it resets my affiliate variable?

Reply via email to