[Resolved] SetFillColor Not Working

Hi Guys,

I’m trying to use a touch listener function to paint an object from my app. The problem is that the setFillColor is not working inside the function. If I move it outside to be executed with the firts run it works fine. The function is being properly called but colors don’t change…
Can some one help me to understand what is going on?

this is the code:

function teto:touch(e)
if e.phase == “ended” then
teto:setFillColor(255,0,0,255)
end
end

teto:addEventListener(“touch”,teto)

Regards,

Tarcisio [import]uid: 140109 topic_id: 25872 reply_id: 325872[/import]

Can’t see anything wrong with that code. Does this work?

[lua]local function touchedTeto(e)
if e.phase == “ended” then
teto:setFillColor(255,0,0,255)
end
end

teto:addEventListener(“touch”,touchedTeto)[/lua]

you could also try

[lua]function teto:touch(e)
if e.phase == “ended” then
e.target:setFillColor(255,0,0,255)
end
end

teto:addEventListener(“touch”,teto)[/lua] [import]uid: 118390 topic_id: 25872 reply_id: 104649[/import]

Hey Tarcisio,

I believe this issue has been fixed in a daily build - just tested in 799 and it worked fine. (I know it didn’t in 704.)

Downloading a new build should fix the issue, please let me know.

Peach :slight_smile: [import]uid: 52491 topic_id: 25872 reply_id: 104652[/import]

There is/was a bug (fixed in a recent daily build) where setFillColor would not update unless there ws some other change in the display.

I would set the alpha to 0.9 on what I was setting the fill color then set the alpha back to 1.0 which forces an OpenGL update and your fill will then show.

[import]uid: 19626 topic_id: 25872 reply_id: 104663[/import]

As Peach mentioned, this was a bug and has been fixed the current Daily Build.

Tom [import]uid: 7559 topic_id: 25872 reply_id: 104692[/import]

Thank you very much Peach!

I got the 799 version and now it’s working fine!

Best regards,

Tarcisio [import]uid: 140109 topic_id: 25872 reply_id: 104755[/import]

Great stuff (and thanks to Tom and Rob for further elaborating) - will mark as resolved :slight_smile: [import]uid: 52491 topic_id: 25872 reply_id: 104821[/import]