Where saveim is a custom function that takes care of all the
saving details, but essentially takes a snapshot with Bitmap.draw .
The problem is that some state change elements don't seem to
change fast enough.
Changing the visibility of a child of 'c' in the state
definition works fine, but changing "includeInLayout" doesn't
appear to get called at the same time.
1. I've ensured that the desired state is reached (by not
restoring the state afterwards).
2. I've tried moving the save comment into a
StateChangeEvent.CURRENT_STATE_CHANGE event listener, but that
still seems to be too early.
I'm guessing the page actually needs to be rendered before
the layout is updated. If that's so, how can I ensure this happens
before save is called? If not, then what triggers the layout update
and can I listen for it?