OpenFL event lifecycle missing stages

OpenFL event lifecycle is missing stages that exist within the Flash player runtime.

For example, two events I use extensively are EVENT.FRAME_CONSTRUCTED and EVENT.EXIT_FRAME.

Event lifecycle, per Flash runtime:

  • EVENT.ENTER_FRAME dispatched
  • Constructor code of children MovieClips is executed
  • MovieCip frame actions executed
  • Frame actions of children MovieCips executed
  • EVENT.EXIT_FRAME dispatched
  • EVENT.RENDER dispatched

Frame constructed was new in Flash Player 10. Within a frame, this indicates when it’s safe to reference newly added display list children.

Exit frame was also new in Flash Player 10. Within a frame, this provides an opportunity to manipulate the display list after all script has executed.

Do these events not translate well? Is there an equivalent?

Walking the display list and generating events for each display object can be expensive. Before adding these, I think I would want to think about optimizing (or making sure we are optimizing) these calls first, particularly skipping them if nothing is expecting to receive it. Surely there’s got to be a way to do that.

I was not familiar with these events, but I’d definitely like to see them implemented – just in a way that minimizes any negative impact the extra two walks through the list might have :slight_smile: