So I have found that I can add multiple enterFrame function to Runtime under the same name. It produces a sort of layering effect. Is there a way to view all the functions running with Runtime's enter frame?
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
How to Check Runtime Events
I don't believe so, no - it was requested at one point however the general feeling (from the community) seemed to be that one should be able to manage their own Runtime events fairly easily.
Peach :)
There isn't no.
best just to manage your code so you don't duplicate things. Descriptive variable / function names are the key
Here's an example of my problem. I have a function called trackMe, and is correctly removed later on in the code. Sometime under unforeseen instances created by the user, I will have trackMe in the event listener more than the amount of removals set up. In fact Peach, this is why I was getting that "not a number error" before, I had a second trackMe function always running in the background that never got removed.
So I am asking, instead of having to guess a maximum margin for error:
1 2 3 | for i =1, 5 do Runtime:removeEventListener("enterFrame", trackMe) end |
Why do you need trackMe to run 5 times every frame? Would it not be better to call trackMe once and loop 5 times inside it over an array of objects?
I share robs doubt...
I said maximum margin for error in reference to a hypothetical situation - an example.
There can be "n + ?" multiple enterFrame functions running under the same name which are left running unless I call remove "n" plus the unknown number which I have no way of knowing other than viewing the existence of the function under runtime. How can I check to see if it is still running?
Okay I seriously need someone to answer my question on how to check if events are active, because now I am coming to appropriate situations, unlike those above, in which I need to offer users flexibility in playing the game, but I can't without knowing if an event is running or already attached.
Corona SDK does not provide a method of keeping track of this.
But you could always do:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | numberOfTrackMeListeners = 0 -- then every time you do: Runtime:addEventListener("enterFrame", trackMe) numberOfTrackMeListeners = numberOfTrackMeListeners + 1 -- and Runtime:removeEventListener("enterFrame", trackMe) numberOfTrackMeListeners = numberOfTrackMeListeners - 1 -- then you could do for i = 1, numberOfTrackMeListeners do Runtime:removeEventListener("enterFrame", trackMe) end numberOfTrackMeListeners = 0 |
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed