Xml – MXML without Flex Framework/Components

apache-flexflashmxmlmxmlc

The Flex compiler can compile "pure AS3" SWF files that don't contain any Flex Component bytecode. So,

Would it be possible to create a custom component framework (used in place of the Flex Framework), that can still be visually laid out using MXML (read: markup), and compiled down to a SWF without any dependencies on the Flex Framework itself?

Best Answer

Yes, it's possible. Your MXML files are essentially just a different way to specify classes. You can see what mxml files boil down to by compiling your project and providing -compiler.keep-generated-actionscript=true to mxmlc.

bar.mxml:

<?xml version="1.0" encoding="utf-8"?>
<flash:Sprite xmlns:flash="flash.display.*">
</flash:Sprite>

After compiling with mxmlc -compiler.keep-generated-actionscript=true bar.mxml, it turns into the following.

generated/bar-generated.as:

package {
    import flash.display.Sprite;
    // bunch of imports
    public class bar extends Sprite {
        public function bar() { super(); }
    }
}
Related Topic