      */
     protected function setColors (foreground :String, background :String) :void
     {
-        var pad :Function = function (str :String) :String {
-            while (str.length < 6) {
-                str = "0" + str;
-            }
-            return str;
-        };
-        setCookie("foreground", foreground = pad(foreground));
-        setCookie("background", background = pad(background));
+        setCookie("foreground", foreground = padColor(foreground));
+        setCookie("background", background = padColor(background));
 
         var fg :uint = parseInt(foreground, 16);
         var bg :uint = parseInt(background, 16);

            field.background = true;
            field.type = TextFieldType.INPUT;
            field.defaultTextFormat = fmt;

            var bevel :BevelFilter = new BevelFilter();
            bevel.distance = 0.5;


import flash.events.ContextMenuEvent;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.FocusEvent;
import flash.events.IOErrorEvent;
import flash.events.KeyboardEvent;
