Hi billston,
I'm afraid to say that the example of the Panel documentation is out of date. Prior to the addition of the Multi state game solution, the onNextFrame method didn't have a panel parameter where to write.
It was not very inefficient to create the panel structure right in there, but it was not certainly the best either. So we changed the onNextFrame method (something we didn't want to do, but have to) and we added the panel as parameter. Thank you for letting us know of this "out of date" example.
About dynamically changing the panels, in the next release we are adding some functionality to do so. You'll be able to resize and move panels on runtime.
About adding event handlers to a panel dynamically: The event handler doesn't keep a copy of its state because we didn't want to add an (in most cases) unnecessary dependency to that class. But as you are creating your own event handlers, extending from the EventHandler class, you can add a parameter to its constructor, or add a method to set and save an instance of a state. Then, you can use that instance to add event handlers in runtime.
Sorry for the long post, here you have a summary:
1- The panel example is out of date. We'll fix it right away
2- In next release (next week) you'll have methods for moving and resizing panels dynamically
3- You can save the state instance in your eventhandler, and use it to add event handlers in runtime.
Best regards,
Sergio.