multicolor text problem

Hi. This is probably a really stupid question because i’m new to Corona, but basically, what i’m trying to do is to get a piece f text to go through all the colors it possibly could. My code so far is this:
local endgame = display.newText( “You Lose!”,100,200, ,124)

local function multic()
for a=0,255 do
for b=0,255 do
for c=0,255 do
endgame:setTextColor( a,b,c)
c=c+1

end
b=b+1
end
a=a+1
end

end
timer.performWithDelay(100, multic)
Unfortunately, when i run the program, it stops responding for about a minute, and then comes back again with black text. Help is desperately needed. [import]uid: 74478 topic_id: 14676 reply_id: 314676[/import]

Hi Christopher,

Here’s why it does not work

You are setting the color fast, really fast, but the app is not getting a breather to update itself.

Secondly, if you are trying to skip , you can set that in the loop itself as

 for a=0,255,2 do  
 end  

instead of a

 for a=0,255 do  
 a=a+1  
 end  

Now the reason that you get *black* text is that while the values *should* cycle through 0 to 255, when you add the c=c+1 or b=b+1, you are essentially getting an additional value , i.e. 256 which is invalid and that causes an error, at this error, the text remains black.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 14676 reply_id: 54276[/import]

Thanks a lot, this really helps.
Another question:
how do you get the code to go different colours instead of just remaining normal?
Thanks again.
[import]uid: 74478 topic_id: 14676 reply_id: 54375[/import]