Hello everyone,
Long-time CoronaSDK daydreamer, first time commenter here. I’m just starting to get into it, but there are quite a few fundamental concepts I’m still struggling with (like cross-device display issues in config.lua, but that’s a topic for a different day).
Right now I’m trying to figure out why the rectangle created by the following snippet only fades to alpha=.5 once. Why doesn’t the myObject.alpha = 1 statement following the transition.to within the function subsequently restore the alpha to 1 after the transition?
I’m missing why the EventListener appears to stop working after one tap. It only works on the first tap, not on subsequent taps.
I know this is a profoundly basic question, but I’m still profoundly ignorant of Corona and Lua at this point.
Thank you for any help, and it’s very nice to be here.
--create object local myObject = display.newRect( 0, 0, 400, 400 ) myObject:setFillColor( .3, .3, .7 ) myObject.x = display.contentCenterX myObject.y = display.contentCenterY -- touch listener function local function myObjectlistener( event ) transition.to(myObject, { time=1000, alpha=.5 }) myObject.alpha = 1 return true end -- listener myObject:addEventListener ( "tap", myObjectlistener )
