# Changing colour with actionscript?

**URL:** <https://forum.kirupa.com/t/changing-colour-with-actionscript/258802>\
**Category:** Uncategorized\
**Created:** [April 28, 2008, 1:39pm UTC](https://forum.kirupa.com/t/changing-colour-with-actionscript/258802 "2008-04-28T13:39:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tommiwalsh](https://avatars.discourse-cdn.com/v4/letter/t/dc4da7/32.png) [@tommiwalsh](https://forum.kirupa.com/u/tommiwalsh)\
**Post date:** [April 28, 2008, 1:39pm UTC](https://forum.kirupa.com/t/changing-colour-with-actionscript/258802/1 "2008-04-28T13:39:07Z")

</div>

Hi everyone,

I have an xml driven menu which I’ve downloaded, in the code theres a section which tells the submenu to be indented my 5 pixels and I was wondering if there was a way to tell it to make the sub menu grey too?

Here are the two bits of the code that I think make the indent (from different parts of the component)-

```auto
CollapseButtonClass.prototype.init = function() {
    if (!this.alpha) {
        this.alpha = {start:25, top:100, bottom:25};
    }
    this.yinactive = this._y;
    this.y = this.yinactive;
    this.bgObjParams = {width:this.parent._width_, height:this.parent._height_, colour:(this.butType == 'secondary') ? (this.parent.sColour) : (this.parent.pColour), alpha:this.alpha.bottom, resize:false, applyColour:true};
    this.txtObjParams = {x:3, y:3, w:this.parent._width_ - 20, h:this.parent._height_ - 5, resize:false, applyBground:false, applyFocus:true, title:String(this._name), applyIndent:(this.butType == 'secondary') ? (true) : (false)};
    this.id = this.attachMovie("Rectangle", "bg", 1, this.bgObjParams);
    this.id = this.attachMovie("TextBox", "txt", 2, this.txtObjParams);
    this.id = this.attachMovie("Rectangle", "bg", 1, this.bgObjParams);
    this.id = this.attachMovie("TextBox", "txt", 2, this.txtObjParams); 
    this.active = false;
    this.enabled = true;
};
CollapseButtonClass.prototype.onSignal = function() {
    if (this.enabled) {
        if (!this.active) {
            this.butType == 'secondary' ? this.bg.setColour(this.parent.sColour) : this.bg.setColour(this.parent.pColour);
            var newOpacity = Mouse.isWithin(this, true) ? this.alpha.top : this.alpha.bottom;
            this.bg._alpha = Math.approach(this.bg._alpha, newOpacity);
        } else {
            this.bg.setColour(this.parent.aColour);
        }
        
        if (this._y <> this.y) {
            this._y = Math.approach(this._y, this.y);
        }
    }
};

```

and the second bit-

```auto
// ---define appearance of textfield content
    this.styleObj = new TextFormat();
    this.styleObj.font = "Helvetica Neue";
    this.styleObj.size = 12;
    this.styleObj.bold = true;
    this.styleObj.leading = 0;
    // if this is a secondary button, indent by 5 pixels
    this.styleObj.indent = this.applyindent ? 15 : 5;
    // ---apply style to textfield
    this.tempText.setTextFormat(this.styleObj);
};

```

Any ideas anyone?

Thanks,  
Tom
