Update: I’ve learned that there’s no easy way to use the Flex Framework without MXML. It may be possible, but probably very difficult. See the comments below for more information.
Maybe I’m just doing this all wrong, but I had the urge to see if I could use the Flex Framework within the new Flash Professional 9 Actionscript 3 Preview, and I ran into some troubles. First of all, it looks like SWC components are completely disabled for Actionscript 3 projects. Luckily, the free Flex 2 SDK comes with it’s source code. I added the path to these files to my class path, and I set the new Document Class parameter to mx.core.Application. I’ve added no additional code to the timeline. When I try to compile, I get a weird error:
**Error** C:\Program Files\Adobe\Flex Framework\frameworks\source\mx\core\Container.as : Line 15, Column 1 : [Compiler] Error #1004: Namespace was not found or is not a compile-time constant.
import flash.display.InteractiveObject;
This same error at the same line in the same file is repeated several times. I find it especially odd that the compiler can’t seem to recognize flash.display.InteractiveObject since that’s one of Flash’s built-in classes. The error list ends with one last error:
ReferenceError: Error #1065: Variable Application is not defined.
No line numbers, just the single line. I assume that one appeared because Container is a dependency to Application.
Can anyone tell me if Flash should even be able to compile the framework? I know that there’s a lot of meta information in those classes. Maybe Flash doesn’t understand some of it. Now, I don’t actually need to compile it within Flash, it was just an interesting little experiment. I’m such a geek.