Not Working as Planned

Okay, the problem I’m having is that it’s only displaying the latest color when you click them, not all of them. Here is the code:

//Makes New Windows
function makeNewWindow(INSTANCE, TITLE, WIDTH, HEIGHT, UNIQUE) {
	_root.z += 2;
	_root.createEmptyMovieClip(INSTANCE+_root.z, _root.z);
	with (eval("_root."+INSTANCE+_root.z)) {
		import flash.filters.GlowFilter;
		var glow:GlowFilter = new GlowFilter(0x000000, 0.5, 10, 10, 2, 5);
		var contentGlow:GlowFilter = new GlowFilter(0x000000, 0.4, 20, 20, 2, 5, true);
		filters = [glow];
		createEmptyMovieClip("closeBtn", 3);
		createEmptyMovieClip("topBar", 2);
		createEmptyMovieClip("contentBox", 1);
		contentBox.filters = [contentGlow];
		contentBox._y = 20;
		_y = _global.POSY+45;
		_x = _global.POSX;
		_global.POSY += 25;
		_global.POSX += 25;
		with (closeBtn) {
			attachMovie("CloseBtn", "Button", 1);
		}
		closeBtn.onRelease = function() {
			removeMovieClip();
		};
		with (topBar) {
			clear();
			lineStyle(1, 0x000000, 25);
			//beginFill(0xAAAAAA, 100);
			beginGradientFill("linear", [0xBBBBBB, 0x888888], [100, 100], [0, 255], {matrixType:"box", x:0, y:-20, w:20, h:20, r:90/180*Math.PI});
			moveTo(0, 0);
			curveTo(0, -20, 20, -20);
			lineTo(WIDTH-20, -20);
			curveTo(WIDTH, -20, WIDTH, 0);
			endFill();
			//Title Bar
			createTextField("header", 1, 0, -22, WIDTH, 22);
			header.text = TITLE;
			header.setTextFormat(titleBarFormat);
		}
		topBar.onPress = function() {
			startDrag();
			_root.z += 2;
			swapDepths(_root.z);
		};
		topBar.onMouseUp = function() {
			stopDrag();
			if (_y<45) {
				_y = 45;
			}
			if (_x<0) {
				_x = 0;
			}
			if (_y>stageHeight) {
				_y = stageHeight;
			}
			if (_x+WIDTH>stageWidth) {
				_x = stageWidth-WIDTH;
			}
		};
		with (contentBox) {
			clear();
			lineStyle(1, 0x000000, 25);
			beginFill(0xEEEEEE, 100);
			moveTo(0, -20);
			lineTo(0, HEIGHT-20);
			lineTo(WIDTH-1, HEIGHT-20);
			lineTo(WIDTH-1, -20);
			endFill();
		}
		contentBox.onRelease = function() {
			_root.z += 2;
			swapDepths(_root.z);
		};
	}
	return "_root."+INSTANCE+_root.z;
}
//Add New Menuitem
function newMenuItem(TEXT) {
	_root.z += 2;
	var WIDTH = length(TEXT)*12;
	_root.TaskBar.attachMovie("TaskBarItem", TEXT+_root.z, _root.z);
	with (eval("_root.TaskBar."+TEXT+_root.z)) {
		TextBox.text = TEXT;
		TextBox._width = WIDTH;
		TaskBackground._width = WIDTH+10;
		_x = taskBarX;
		taskBarX += WIDTH+11;
		return "_root.TaskBar."+TEXT+_root.z;
	}
}
//Starting Vars
var startClickDragX = 0;
var startClickDragY = 0;
_global.stageWidth = 800;
_global.stageHeight = 600;
var z = 20;
_global.taskBarX = 0;
_global.POSX = 0;
_global.POSY = 0;
_global.bg = "CCCCCC";
//Desktop BG
_root.createEmptyMovieClip("DesktopBG", -100);
_root.DesktopBG.BG._x = 10;
_root.DesktopBG.BG._y = 35;
DesktopBG.onEnterFrame = function() {
	if (length(_global.bg) == 6) {
		with (_root.DesktopBG) {
			_root.alreadyLoaded = null;
			this.createEmptyMovieClip("ColorBG", 1);
			with (ColorBG) {
				clear();
				lineStyle(2, 0xFFFFFF, 0);
				beginFill("0x"+_global.bg, 100);
				moveTo(0, 0);
				lineTo(stageWidth, 0);
				lineTo(stageWidth, stageHeight);
				lineTo(0, stageHeight);
				endFill();
			}
		}
	} else {
		with (_root.DesktopBG) {
			if (_root.alreadyLoaded != _global.bg) {
				//attachMovie("Loader", "PictureBG", 1);
				createEmptyMovieClip("PictureBG", 1);
				with (PictureBG) {
					_root.alreadyLoaded = _global.bg;
					createEmptyMovieClip("loadish", 1);
					loadish.loadMovie(_global.bg);
					//_x = -57;
					//_y = -43;
					_root.DesktopBG.PictureBG.onEnterFrame = function() {
						_width = 800;
						_height = 600;
						onEnterFrame = function () {
						};
					};
				}
			}
		}
	}
};
//Taskbar
_root.attachMovie("TaskBar", "TaskBar", 1000);
BG = newMenuItem("Background");
eval(BG).onRelease = function() {
	var WINDOW = makeNewWindow("BGPREFS", "Background Preferences", 250, 300, true);
	with (eval(WINDOW).contentBox) {
		createEmptyMovieClip("ColorBoxes", 1);
		with (ColorBoxes) {
			_x = 15;
			_y = 15;
			colorpal = ["FF0000", "00FF00", "0000FF", "AA88AA", "168D27", "BBBBBB", "FFF000"];
			currx = 0;
			curry = 0;
			for (curr=0; curr<colorpal.length; curr++) {
				_root.z += 2;
				createEmptyMovieClip(colorpal[curr], curr);
				with (eval(colorpal[curr])) {
					_x = currx;
					_y = curry;
					clear();
					lineStyle(1, 0x000000, 25);
					beginFill("0x"+colorpal[curr], 100);
					moveTo(2.5, 0);
					lineTo(52.5, 0);
					lineTo(52.5, 25);
					lineTo(2.5, 25);
					endFill();
					currx += 55;
					if (currx == 220) {
						currx = 0;
						curry += 27.5;
					}
					onRelease = function () {
						trace(_name);
					};
				}
			}
		}
	}
};
newMenuItem("New Text Document");
newMenuItem("New Image");

It updates the background to either an image or a color on each frame, and it’s updated by the _global.bg variable. I’m having a problem with the onRelease function at the end though. Sorry if I didn’t explain this well.

Zach

PS - I know a lot of the scripting is messy, but I have to go back through and fix it fully.