Would it be better (performance-wise) to have multiple ENTER_FRAME event listeners for different actions, or to have one ENTER_FRAME event listener to handle all activities that are to occur on every frame? For example, I have two images that scroll down the screen and then repeat to simulate continuous movement. I also check to make sure that my HUD is always at the front of the stage hierarchy. Right now, I have an ENTER_FRAME event listener for each one. So, would it be better to place all three into one function so there is only one ENTER_FRAME event listener, or is it better to have separate event listeners for each one, or is the number of calculations the same either way resulting in no difference in performance?
Comments
For example, there is Player Group, UI Group, background Group.
Then you add all UI at UI Group, all objects at Player Group, and all background at background Group?
Regarding Enter_Frame, i checked far in the past, and there is no much different between those two way in term of speed. It just the matter of whether you want an enter frame to not overlap each other or not.
For example, if you add enter_frame to Character to handle it's movement, while camera also moving, it would be much better to add camera handler at the same enter_frame, after the character movement.
As for the HUD (which is just buttons and a score counter at this point), I have lots of "enemies" and "bullets" being added and removed from the stage all the time. I was have problems with them being on top of the buttons. Adding a quick check at every enter_frame to say, "if the hudGroup is not at the front (bottom) of the stage hierarchy, then move it there, " was a quick and easy fix. There is probably a better way to do this, as you suggested, and I will probably make some changes later.
Thanks again!