This content has been marked as final. Show 5 replies
You can't acces any components or custom classes from a Flash 8 swf, since the underlying ActionScript 2 code is incompatible with the ActionScript 3 interpreter used by Flex 2. You can import static assets and movie clips.
So, I know this isn't related to the topic, but I have been getting confusing messages regarding ActionScript 3. Is it COMPILED or is it INTERPRETED?
It's byte code much like Java. Which doesn't answer your question, since this is a debate as well. Basically the bottom line is, its compiled for the run-time environment, which is then interpreted by the VM.
Hope that helps.
OK, so the VM is like a computer that doesn't really exist - a machine modeled in software - and the target "machine language" is the Flash byte code spit out by the ActionScript 3 compiler which is, in turn, loaded into and executed by the VM. Is that right (or close enough)?
However, I'm not sure this completely answers my question as I have heard someone mention (and maybe they were not fully correct) that ActionScript 2 was interpreted and that ActionScript 3 is compiled. Is this a faulty comparison? It seems like it must be since each version targets a VM.
In the traditional sense, "compiled" meant that a program written in a high-level language was converted entirely into a computer's "native" language. This is usually some kind of assembly language whose operations the CPU can execute directly (more or less). If a program was "interpreted", it meant that the high-level language was turned into assembly/machine code as it was run.
So in this sense, a program running purely in a VM is interpreted as far as the hardware is concerned. However, modern VMs have introduced the idea of "just-in-time" (JIT) compiling where all or parts of a program's bytecode is compiled into native machine code before it is executed. Java has had this for a while and, as far as I know, the folks at Adobe introduced this with Flash Player 8.5/9. In this sense, it can be said that AS2 was interpreted while AS3 is compiled. However, I don't know how "thorough" the JIT compiling is, so it may be half/half for an AS3 program.