You, like... modified the engine or something?
I didn't modify the engine, I simply put some AS3 files in the same folder as the behaviors. Then, I created a simple code mode behavior that uses those file (it basically sets the scene and camera up and renders it into a bitmap, which is in place pasted on the screen).
Would it be possible to "ray cast" only certain elements of a scene?
I have total control of what I want to "ray cast".
Could the lag issues be covered by limiting the movement range of the player to only going a bit backwards and forwards?
The poor performance can be improved, but I haven't looked into that. For example, I realized there's a huge performance drop once the wall's height doesn't fit in the screen.
The improved performance I experienced with the browser has certainly encouraged me to develop this further.