Action Script: Color Object

Out of context: Reply #7

  • Started
  • Last post
  • 7 Responses
  • F_EddyShears0

    allright, try this for an AS color change:

    //on actions frame (_root):

    Color.prototype.setColorRGB = function (r, g, b) {

    if (!isNaN(r+g+b) && r=0 && g=0 && b=0) {

    r = (parseInt (r)).toString(16); r.length == 1 ? r = "0" + r : r;
    g = (parseInt (g)).toString(16); g.length == 1 ? g = "0" + g : g;
    b = (parseInt (b)).toString(16); b.length == 1 ? b = "0" + b : b;

    this.setRGB(parseInt("0x"+r+g+b...
    }
    }

    //usage:

    onClipEvent(load) {
    c = new Color(mc);
    c.setColorRGB(255,0,255);
    }

    //or:

    on (release) {
    c = new Color(_root.mc_2);
    c.setColorRGB(0,0,0);
    }

View thread