@brandonbuffa2010 I’m not sure I fully understand your first question.
But lets assume you have a display object called ball and you want it to respond to different events, like, touch, tap etc. You define a function for that specific event. Lua gives you different ways to do things. My preferred way is like this:
[code]
local ball = display.newImage(“ball.png”)
ball.x = 100
ball.y = 100
local function ballTouchHandler(event)
– code you want to run when the ball is touched
end
ball:addEventListener(“tap”,ballTouchHandler)
Of course you really can’t put a touch listener and a tap listener on the same object since they both watch for the item to be touched. But you can put other listeners like “collision” and such using the same mechanisim.
As for the last question, think of “Runtime” is the master program. These listeners are not attached to any specific object but rather to the system as a whole. This could include things that monitor system events like rotation, low memory and tilt actions. These events only fire when the specific events happen if at all. The user may not ever rotate the device for instance.
One of the Runtime events is something called “enterFrame”. Your app runs at either 30 frames per second or 60 frames per second (30 is the default), so every 1/30th (or 1/60th) of a second Corona updates the display. Prior to the screen update, if there is an enterFrame event defined, it will run that code first. This is frequently how we have a “Game Loop” that runs continuously instead of waiting on some user interaction to do things. [import]uid: 19626 topic_id: 22575 reply_id: 90015[/import]