I honestly have no business commenting here, as my JS knowledge is terribly weak, but I liked the challenge. 🙂
Would this be part of the problem maybe?
allowScriptAccess="always"
Does that allow foreign code to execute?
Hopefully someone else solves this, cause I'm curious too.