Move all configurable parameters to an XML definition.
Create multiple XML documents for each customization.
In code, establish default values for configurable parameters, then load the XML and reference values of the XML document as overrides to those defaults.
For a production build, XML can be embedded in the assembly if loading an external resource is an issue for deployment.
By loading different configuration XML documents, you could change the definition during runtime, and by using the dynamic configuration model you could draft a theme editor to view changes real time.
ConfigurationModel.as
package
{
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class ConfigurationModel
{
/** ======== configuration ======== */
public static var color:uint = 0xff00ff;
public static var fontName:String = "Arial";
/** ======== serialization ======== */
public static function loadConfiguration(url:String):void
{
var loader:URLLoader = new URLLoader(new URLRequest(url));
loader.addEventListener(Event.COMPLETE, completeHandler);
}
protected static function completeHandler(event:Event):void
{
var xml:XML = new XML(event.target.data);
if (xml.color)
color = xml.color;
if (xml.fontName)
fontName = xml.fontName;
}
}
}
Example configuration: AcmeClientConfiguration.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<color>0xff0000</color>
<fontName>Calibri</fontName>
</configuration>