Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aerial as3 config-alt #37

Open
cesaric opened this issue Sep 28, 2011 · 0 comments
Open

Aerial as3 config-alt #37

cesaric opened this issue Sep 28, 2011 · 0 comments
Labels

Comments

@cesaric
Copy link
Member

cesaric commented Sep 28, 2011

I was thinking of an as3 compliment to config-alt.xml. How about something like:


public class Aerial
{
    public static const DEBUG_MODE:Boolean = true;
        
    public static const SERVER:Aerial = new Aerial("acme.com", "dev.acme.com");
    public static const SERVER_PROTOCOL:Aerial = new Aerial("https://", "http://");
    public static const SERVER_URL:String = SERVER_PROTOCOL + SERVER + "/server.php";
        
    public static const USE_ENCRYPTION:Boolean = false;

    private var _value:*;
    private var _altValue:*;
        
    public function Aerial(value:*, altValue:* = null)
    {
        _value = value;
        _altValue = altValue;
    }
        
    public function toString():String
    {
        return String(DEBUG_MODE && _altValue ? _altValue : _value);
    }
        
    public function valueOf():Object
    {
        return (DEBUG_MODE && _altValue ? _altValue : _value);
    }

}

It's a drop-in replacement for any existing projects that are only using string constants. Other types like Boolean will need to implement the 'valueOf()' to retrieve the proper type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant