Ah, there’s one other issue with your code that I didn’t notice at first. You can’t add a “touch” listener to the Runtime object. You have to add it to an actual display object. (http://developer.coronalabs.com/content/events-and-listeners) You could, for example, add it to the ball itself, or you could add it to your background image, whichever you want to trigger the growing and shrinking. Give that a try and let me know if it works.
If you don’t mind repasting the latest, revised version of your full code (including the part where you create the ball), I’ll take a look.
You can create a touch event for the entire scene, but not through a runtime listener. Instead, you can create a background image and apply the touch listener to that. If you want, you can create a transparent rectangle using display.newRect() (but be aware, if you make it fully transparent, set its isHitTestable property to true in order to make sure it receives touch events).
I haven’t tried running this code yet, because I notice that the transitions haven’t been change to what I was suggesting originally. In the ballIncrease function, instead of [lua]transition.to( ball, {time=5000, w=5, h=5} )[/lua], try [lua]transition.to( ball, {time=5000, xScale=5, yScale=5} )[/lua], and make a similar change in the transition in the ballReturn function.
Ah, there’s one other issue with your code that I didn’t notice at first. You can’t add a “touch” listener to the Runtime object. You have to add it to an actual display object. (http://developer.coronalabs.com/content/events-and-listeners) You could, for example, add it to the ball itself, or you could add it to your background image, whichever you want to trigger the growing and shrinking. Give that a try and let me know if it works.
If you don’t mind repasting the latest, revised version of your full code (including the part where you create the ball), I’ll take a look.
You can create a touch event for the entire scene, but not through a runtime listener. Instead, you can create a background image and apply the touch listener to that. If you want, you can create a transparent rectangle using display.newRect() (but be aware, if you make it fully transparent, set its isHitTestable property to true in order to make sure it receives touch events).
I haven’t tried running this code yet, because I notice that the transitions haven’t been change to what I was suggesting originally. In the ballIncrease function, instead of [lua]transition.to( ball, {time=5000, w=5, h=5} )[/lua], try [lua]transition.to( ball, {time=5000, xScale=5, yScale=5} )[/lua], and make a similar change in the transition in the ballReturn function.