colorPalette conflicts with comboBox

Does anyone know why the following line is incompatible with the comboBox component that ships with MX2004 and up?


Object.registerClass("ColorPalette", ColorPalette);

The full story
I am using a colorPalette developed by Govinda Sarkhel (located at http://www.flash-db.com/Components/?swfID=23&sComType=Color%20Palette)

When I put his colorPalette on the stage with the comboBox component, the colorPalette shows up and works but the comboBox component is not visible or working. I believe I narrowed the problem down to the line listed above. The line is contained inside the colorPalette MC.

Below are the *** for the comboBox and the colorPalette:

The ColorPalette AS inside the MC



#initclip 1
MovieClip.prototype.getNextHighestDepth = function() {
    var t = -Infinity;
    for (var i in this) {
        if (this*.getDepth() != null && this*._parent == this) {
            t = Math.max(t, this*.getDepth());
        }
    }
    return (t>-1) ? ++t : 0;
};
//CREATING OBJECT OF MOVIECLIP ## INHERITENCE ##
ColorPalette.prototype = new MovieClip();
// COLORPALETTE CLASS ##
function ColorPalette() {
    this.stor = this._parent[this.stor];
    this.attachMovie("hold_main1", "hold_main", 0);
    this.setButtonColor(this.bcol);
    this.col_pick.arrow1._visible = this.sa;
    this.hold_main._alpha = 100;
    this.apPosition(this.pos);
    this.hold_main.but._visible = 0;
    mx = 0;
    my = 0;
    st1 = 0;
    st2 = 0;
    st3 = 0;
    rr = "";
    gg = "";
    bb = "";
    targ = "hold1";
    // THREE SLABS LOAD IN HOLD1
    for (k=1; k<=6; k++) {
        for (i=1; i<=6; i++) {
            for (j=1; j<=6; j++) {
                this.hold_main[targ].attachMovie("but", "b"+j+i+k, j+""+i+""+k);
                this.hold_main[targ]["b"+j+i+k]._x = mx;
                // X POSITION ##
                this.hold_main[targ]["b"+j+i+k]._y = my;
                // Y POSITION ##
                if (st1 == 12) {
                    rr = "CC";
                } else if (st1 == 15) {
                    rr = "FF";
                } else {
                    rr = st1+""+st1;
                }
                if (st2 == 12) {
                    gg = "CC";
                } else if (st2 == 15) {
                    gg = "FF";
                } else {
                    gg = st2+""+st2;
                }
                if (st3 == 12) {
                    bb = "CC";
                } else if (st3 == 15) {
                    bb = "FF";
                } else {
                    bb = st3+""+st3;
                }
                mcol = new Color(this.hold_main[targ]["b"+j+i+k]);
                mcol.setRGB("0x"+rr+gg+bb);
                this.hold_main[targ]["b"+j+i+k].onRelease = function() {
                    mcol = new Color(this);
                    this._parent._parent._parent.onChange("0x"+mcol.getRGB().toString(16));
                    coo1 = new Color(this._parent._parent._parent.col_pick.show_col);
                    coo1.setRGB("0x"+mcol.getRGB().toString(16));
                    this._parent._parent._visible = false;
                    this._parent._parent.swapDepths(this._parent.depth);
                    var mtf = new TextFormat();
                    mtf.color = "0x"+mcol.getRGB().toString(16);
                    Selection.setFocus(eval(_global.body_txt));
                    Selection.setSelection(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd);
                    eval(_global.body_txt).setTextFormat(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd, mtf);
                    Selection.setSelection(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd);
                    Selection.setSelection(this.tempBegin, this.tempEnd);

                    /*
                    Selection.setFocus(eval(this._parent._parent._parent.stor));
                    Selection.setSelection(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd);
                    eval(this._parent._parent._parent.stor).setTextFormat(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd, mtf);
                    Selection.setSelection(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd);
                    Selection.setSelection(this.tempBegin, this.tempEnd);
                    */
                };
                this.hold_main[targ]["b"+j+i+k].onRollOver = function() {
                    mcol = new Color(this);
                    coo = new Color(this._parent._parent._parent.col_pick.show_col);
                    coo.setRGB("0x"+mcol.getRGB().toString(16));
                };
                this.hold_main[targ]["b"+j+i+k].useHandCursor = false;
                my += 11;
                st3 += 3;
            }
            my = 0;
            mx += 11;
            st3 = 0;
            st2 += 3;
        }
        st3 = 0;
        st2 = 0;
        st1 += 3;
        if (st1 == 9) {
            targ = "hold2";
            // AND THREE IN HOLD2
            mx = 0;
        }
    }
    r = 0;
    g = 0;
    b = 0;
    for (i=1; i<=12; i++) {
        this.hold_main.hold3.attachMovie("but", "c"+i, i);
        this.hold_main.hold3["c"+i]._y = this.hold_main.hold3["c"+(i-1)]._y+this.hold_main.hold3["c"+(i-1)]._width+1;
        mcoll = new Color(this.hold_main.hold3["c"+i]);
        if (i<=6) {
            if (r == 12) {
                mcoll.setRGB(0xCCCCCC);
            } else if (r == 15) {
                mcoll.setRGB(0xFFFFFF);
            } else {
                mcoll.setRGB("0x"+r+r+g+g+b+b);
            }
            r += 3;
            g += 3;
            b += 3;
        }
        if (i == 7) {
            mcoll.setRGB(0xFF0000);
        }
        if (i == 8) {
            mcoll.setRGB(0x00FF00);
        }
        if (i == 9) {
            mcoll.setRGB(0x0000FF);
        }
        if (i == 10) {
            mcoll.setRGB(0xFFFF00);
        }
        if (i == 11) {
            mcoll.setRGB(0x00FFFF);
        }
        if (i == 12) {
            mcoll.setRGB(0xFF00FF);
        }
        this.hold_main.hold3["c"+i].onRelease = function() {
            mcol = new Color(this);
            coo = new Color(this._parent._parent._parent.stor);
            coo.setRGB("0x"+mcol.getRGB().toString(16));
            this._parent._parent._parent.onChange("0x"+mcol.getRGB().toString(16));
            coo1 = new Color(this._parent._parent._parent.col_pick.show_col);
            coo1.setRGB("0x"+mcol.getRGB().toString(16));
            this._parent._parent._visible = false;
            this._parent._parent.swapDepths(this._parent.depth);
            var mtf = new TextFormat();
            mtf.color = "0x"+mcol.getRGB().toString(16);

            Selection.setFocus(eval(_global.body_txt));
            Selection.setSelection(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd);
            eval(_global.body_txt).setTextFormat(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd, mtf);
            Selection.setSelection(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd);

            /*
            Selection.setFocus(eval(this._parent._parent._parent.stor));
            Selection.setSelection(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd);
            eval(this._parent._parent._parent.stor).setTextFormat(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd, mtf);
            Selection.setSelection(this._parent._parent._parent.tempBegin, this._parent._parent._parent.tempEnd);
            */
            };
        this.hold_main.hold3["c"+i].onRollOver = function() {
            mcol = new Color(this);
            coo = new Color(this._parent._parent._parent.col_pick.show_col);
            coo.setRGB("0x"+mcol.getRGB().toString(16));
        };
        this.hold_main.hold3["c"+i].useHandCursor = false;
    }
    this.hold_main._visible = false;
    this.col_pick.onPress = function() {
        if (!this._parent.hold_main._visible) {
            this._parent.depth = this._parent.getNextHighestDepth();
            this._parent.swapDepths(this._parent._parent.getNextHighestDepth());
        }
        this._parent.tempBegin = this._parent._parent.selectedBeginText;
        this._parent.tempEnd = this._parent._parent.selectedEndText;
    };
    this.col_pick.onRelease = function() {
        if (this._parent.hold_main._visible) {
            this._parent.hold_main._visible = false;
            this._parent.swapDepths(this._parent.depth);
        } else {
            this._parent.hold_main._visible = true;
        }
    };
    this.col_pick.onRollOver = function() {
        this._parent._parent.toolTip._visible = true;
        this._parent._parent.toolTip.tipText.text = "Color";
    };
    this.col_pick.onRollOut = function() {
        this._parent._parent.toolTip._visible = false;
    };
}
ColorPalette.prototype.setButtonColor = function(bcol) {
    hold_col = new Color(this.col_pick.base);
    hold_col.setRGB(bcol);
};
ColorPalette.prototype.showArrow = function(sa) {
    this.col_pick.arrow1._visible = sa;
};
ColorPalette.prototype.apPosition = function(pos) {
    if (pos == "TopLeft") {
        this.hold_main._x = -146;
        this.hold_main._y = -138;
    } else if (pos == "TopRight") {
        this.hold_main._x = 0;
        this.hold_main._y = -138;
    } else if (pos == "BottomLeft") {
        this.hold_main._x = -146;
        this.hold_main._y = 32;
    } else if (pos == "BottomRight") {
        this.hold_main._x = 0;
        this.hold_main._y = 32;
    }
};
ColorPalette.prototype.targ = function(msg) {
    this.stor = msg;

};


// REGISTERING CLASS ##
Object.registerClass("ColorPalette", ColorPalette);
#endinitclip

The AS for the comboBox


myTextFormat = new TextFormat();
myTextFormat.bold = false;
myTextFormat.italic = false;
myTextFormat.underline = false;

sizeList.addItem("6", 6);
sizeList.addItem("8", 8);
sizeList.addItem("9", 9);
sizeList.addItem("10", 10);
sizeList.addItem("11", 11);
sizeList.addItem("12", 12);
sizeList.addItem("14", 14);
sizeList.addItem("16", 16);
sizeList.addItem("20", 20);
sizeList.addItem("24", 24);
sizeList.addItem("36", 36);
sizeList.addItem("48", 48);
sizeList.addItem("56", 56);
sizeList.addItem("72", 72);
sizeList.setSize(40);
sizeListChange = new Object();
sizeList.addEventListener("change", sizeListChange);
sizeListChange.change = function(evt){
    myTextFormat = currentFormat;
    myTextFormat.size = evt.target.selectedItem.label;
    myTextFormat.textHeight = evt.target.selectedItem.data;
    _global.body_txt.setTextFormat(begin, end, myTextFormat);
};

enterFrameMovie.onMouseUp = function(){
    cp.setValue(currentFormat.color);
    if (currentFormat.size == 6) {
        sizeList.setSelectedIndex(0);    
    }
    else if (currentFormat.size == 8) {
        sizeList.setSelectedIndex(1);    
    }
    else if (currentFormat.size == 9) {
        sizeList.setSelectedIndex(2);    
    }
    else if (currentFormat.size == 10) {
        sizeList.setSelectedIndex(3);    
    }
    else if (currentFormat.size == 11) {
        sizeList.setSelectedIndex(4);    
    }
    else if (currentFormat.size == 12) {
        sizeList.setSelectedIndex(5);    
    }
    else if (currentFormat.size == 14) {
        sizeList.setSelectedIndex(6);    
    }
    else if (currentFormat.size == 16) {
        sizeList.setSelectedIndex(7);    
    }
    else if (currentFormat.size == 20) {
        sizeList.setSelectedIndex(8);    
    }
    else if (currentFormat.size == 24) {
        sizeList.setSelectedIndex(9);    
    }
    else if (currentFormat.size == 36) {
        sizeList.setSelectedIndex(10);    
    }
    else if (currentFormat.size == 48) {
        sizeList.setSelectedIndex(11);    
    }
    else if (currentFormat.size == 56) {
        sizeList.setSelectedIndex(12);    
    }
    else if (currentFormat.size == 72) {
        sizeList.setSelectedIndex(13);    
    }
}
enterFrameMovie.onEnterFrame = function(){
    woohoo = Selection.getFocus(); 
    if (woohoo eq _global.body_txt) { 
        begin = Selection.getBeginIndex(); 
        end = Selection.getEndIndex(); 
        cursor = Selection.getCaretIndex(); 
    }
    currentFormat = _global.body_txt.getTextFormat(begin, end);
}

*Note: The AS above requires a empty MC on the stage at the same level with the instance name “enterFrameMovie”

*Note: The colorPalette requires the below script inorder to select and change the color of a text. It must be on the same level as the colorPalette.


st = setInterval(checkSelection, 100, this);
function checkSelection(msg) {
    msg.selectedBeginText = Selection.getBeginIndex();
    msg.selectedEndText = Selection.getEndIndex();
}

The Fla is located at www.kairosworld.com/posting/CBandCP.zip