MovieClip.prototype.fade = function(target, nr, ng, nb) {
col = new Color(target);
// rilevo valori RGB attuali
oCol = col.getTransform();
orb = oCol.rb;
ogb = oCol.gb;
obb = oCol.bb;
// impostazione colore iniziale
startRGB = new Array(orb, ogb, obb);
endRGB = new Array(nr, ng, nb);
//
function colorTween() {
for (i=0; i<3; i++) {
difference = endRGB[i]-startRGB[i];
// speed
startRGB[i] += difference*.15;
}
col.setRGB(startRGB[0] << 16 | startRGB[1] << 8 | startRGB[2]);
}
//
target.onEnterFrame = function() {
colorTween();
};
};