I have two Cairngorm MVC Flex applications (a full version and lite version of the same app) that share many Classes. I have put these Classes into a Flex Library Project that compiles as an SWC. Both applications use some static String constants. Right now, I am storing these in the ModelLocator:
package model
{
[Bindable]
public class ModelLocator
{
public static var __instance:ModelLocator = null;
public static const SUCCESS:String = "success";
public static const FAILURE:String = "failure";
public static const RUNNING:String = "running";
...
}
}
This just doesn't seem like the best place to store these constants, especially now that they are used by both applications, and I have setup each application to have its own ModelLocator Class. Plus this is not the purpose of the ModelLocator Class.
What would be a good way to store these constants in my shared Library?
Should I just create a Class like this?:
package
{
[Bindable]
public class Constants
{
public static const SUCCESS:String = "success";
public static const FAILURE:String = "failure";
public static const RUNNING:String = "running";
}
}
and then reference it like this:
if (value == Constant.SUCCESS)
...