5 Replies Latest reply on Jun 27, 2006 7:00 AM by inlineblue

    Using Flash 8 swf in Flex2

    Nelson
      Is it possible to load a swf created using Flash8 into a Flex2 app and reference component properties (like a textInput box) within that swf file? If so, how would I go about doing this. I'm able to load the swf using <mx:SWFLoader>, but I can't reference any properties inside that movieclip. Any suggestions would be most appreciated.

      Thanks,
      -Nelson
        • 1. Re: Using Flash 8 swf in Flex2
          ur_dtrain Level 1
          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.
          • 2. Re: Using Flash 8 swf in Flex2
            Kwooda Level 1
            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?
            • 3. Re: Using Flash 8 swf in Flex2
              ur_dtrain Level 1
              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.
              • 4. Re: Using Flash 8 swf in Flex2
                Kwooda Level 1
                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.
                • 5. Re: Using Flash 8 swf in Flex2
                  inlineblue Level 1
                  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.