Hi Artūras, and welcome!
I'm not sure why you would still want to use Flash at all anymore, when we can use HTML5, but here a few stabs at your questions about Scala.js.
Basically, it is a Scala compiler plugin, that turns a Scala AST that has been simplified by most of the Scala-to-JVM pipeline until a point where it is relatively straightforward to translate it to a JavaScript AST. The phase that does this translation is in GenJSCode.scala:
https://github.com/scala-js/scala-js/blob/master/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala
There are 2 big parts in this file. The first part deals with translating everything that's "outside methods", i.e., classes, traits, implementation classes, fields, module accessors, and the method signatures. That part ends about here:
https://github.com/scala-js/scala-js/blob/master/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala#L939
at which point starts the second part, which deals with code generation, i.e., translating the body of a method, which is a Scala expression, into JavaScript statements that are inside the JavaScript "method".
Further than this high-level view, the comments in the code should give a clear overview of how it works.
So, it does not work either on the JVM bytecode nor on the Scala source code, but somewhere in-between. It translates first to a ~JavaScript AST, and then a printer emits JS source code corresponding to this AST, along with source maps.
That's the basic idea, and to someone with the knowledge of the Scala compiler, a prototype that supports all-but-the-corner-cases can be implemented in a few months, possibly weeks. Then comes "all the rest": corner cases, tooling, integration with sbt and IDE, unit testing capabilities, testing of the compiler itself, libraries, optimizer, etc. This takes, well, years, and the support of a community, which I've been very lucky to get quite early for Scala.js.