why does my object fade?

hi - i have an object (newImageRect) to which is attached a touch event listener. When the object is touched, it fades. It doesn’t disappear, but it just looks ‘greyed out’. I’ve never seen this behaviour before. I realize that usually when I have such an object, touching it leads to its removal, but with this app I have objects that are not removed after touching.

Anyway I see nothing in my code to get the object to fade, so I guess it’s a default. How can I stop it from fading?

thanks.

Are you sure the item is a newImageRect, and not a widget.newButton?

hi, yup, newImageRect. Here’s a code sample:

--place the object myData.naturalToTap = display.newImageRect(myData.intsDisplayGroup, "pics/natural.png",myData.s\_width \* 0.04,myData.s\_height \* 0.1) myData.naturalToTap.anchorX = 0.5 myData.naturalToTap.anchorY = 0.5 myData.naturalToTap.x = myData.s\_width \* 0.05 myData.naturalToTap.y = myData.s\_height\*.2 myData.naturalToTap.acctype = "natural" --add listener somewhere else... myData.naturalToTap:addEventListener("touch",i.accListener) --listener code: if ( event.phase == "began" ) then         display.getCurrentStage():setFocus(event.target)     event.target:setFillColor(.87,.3,.1,.3)    elseif  ( event.phase == "ended" ) then         display.getCurrentStage():setFocus(nil) -- do some other stuff end -- of listener -- listener stays live throughout one turn then gets removed by a different function once the turn is over: myData.naturalToTap:removeEventListener("touch",i.accListener)

It’s fading out because in your “began” phase you are reducing the alpha:

event.target:setFillColor(.87,.3,.1,.3)

The fourth argument to setFillColor is alpha (red, green, blue, alpha) which you are setting to 0.3

that was it, thanks.

Are you sure the item is a newImageRect, and not a widget.newButton?

hi, yup, newImageRect. Here’s a code sample:

--place the object myData.naturalToTap = display.newImageRect(myData.intsDisplayGroup, "pics/natural.png",myData.s\_width \* 0.04,myData.s\_height \* 0.1) myData.naturalToTap.anchorX = 0.5 myData.naturalToTap.anchorY = 0.5 myData.naturalToTap.x = myData.s\_width \* 0.05 myData.naturalToTap.y = myData.s\_height\*.2 myData.naturalToTap.acctype = "natural" --add listener somewhere else... myData.naturalToTap:addEventListener("touch",i.accListener) --listener code: if ( event.phase == "began" ) then         display.getCurrentStage():setFocus(event.target)     event.target:setFillColor(.87,.3,.1,.3)    elseif  ( event.phase == "ended" ) then         display.getCurrentStage():setFocus(nil) -- do some other stuff end -- of listener -- listener stays live throughout one turn then gets removed by a different function once the turn is over: myData.naturalToTap:removeEventListener("touch",i.accListener)

It’s fading out because in your “began” phase you are reducing the alpha:

event.target:setFillColor(.87,.3,.1,.3)

The fourth argument to setFillColor is alpha (red, green, blue, alpha) which you are setting to 0.3

that was it, thanks.