Try using a for loop (for (temp.alpha = 1; temp.alpha > 0; temp.alpha -= 0.05

{ } )
and then setting the objects alpha, if you're not using as object reference use
HTML Code:
changeimgcolors(imgindex, red, green, blue, alpha);
changeimgmode(imgindex, 1); //This sets a nice fade