now checking if context is valid two times per frame (closes #507)

The context is now checked once before dispatching the runtime events and once before rendering. That way, if a runtime event code causes the context to be lost, rendering will pause until the context is restored. Downside: this causes one additional String allocation per frame that can't be avoided (but will hopefully be fixed by Adobe in the future).