I’m looking at the API reference, and it only shows you being able to add the enterFrame event listener to the Runtime object.
Can someone please just clarify for me: Is Runtime the only object that sends enterFrame callbacks?
Are there any others that send enterFrame callback, such as display.newGroup or some such?
The reason I ask, is because I can do this with tap and touch eventListeners on a display.newGroup object.
I have a premade group object created via a group.new function and pass parameters to set it up. So you’d have a group.enterFrame (or group:enterFrame?) that can have it’s function set externally via parameters, and then it adds an eventListener to itself if it detects the enterFrame function is not nil.
Am I supposed to have the object add it’s enterFrame function to the Runtime event listeners?
Here is an example of what I would like to have.
function group.new(options) local grp = display.newGroup() grp.enterFrame = options.enterFrame if(grp.enterFrame) then grp:addEventListener("enterFrame", grp) -- Do other things to set up the group return grp end