Published in: ActionScript
import flash.geom.Transform; import flash.geom.ColorTransform; ... // sets color to each rowList[i].bg movieClip // initColor if this color has to be the default color private function setColor(target:MovieClip, color:String, init_color:Boolean) { if (color.substr(0, 1) == "#") color = color.substr(1); var _r = (color != undefined) ? "0x" + color.substr(0, 2) : 0; var _g = (color != undefined) ? "0x" + color.substr(2, 2) : 0; var _b = (color != undefined) ? "0x" + color.substr(4, 2) : 0; var t = new Transform(mc); if (bg != undefined) var new_ct = new ColorTransform(0, 0, 0, 0, _r, _g, _b, 255); else var new_ct = mc.init_color; t.colorTransform = new_ct; // keeps default colorTransform when needed if (init_color) mc.init_color = new_ct; }
You need to login to post a comment.
