Possible to use Flex Framework/Components without using MXML?

后端 未结 4 1691
情话喂你
情话喂你 2020-12-08 10:56

Is it possible to use the Flex Framework and Components, without using MXML? I know ActionScript pretty decently, and don\'t feel like messing around with some new XML langu

4条回答
  •  旧巷少年郎
    2020-12-08 11:54

    NOTE: The below answer will not actually work unless you initialize the Flex library first. There is a lot of code involved to do that. See the comments below, or other answers for more details.


    The main class doesn't even have to be in MXML, just create a class that inherits from mx.core.Application (which is what an MXML class with a root node is compiled as anyway):

    package {
    
      import mx.core.Application;
    
    
      public class MyFancyApplication extends Application {
    
        // do whatever you want here
    
      }
    
    }
    

    Also, any ActionScript code compiled with the mxmlc compiler -- or even the Flash CS3 authoring tool -- can use the Flex classes, it's just a matter of making them available in the classpath (refering to the framework SWC when using mxmlc or pointing to a folder containing the source when using either). Unless the document class inherits from mx.core.Application you might run in to some trouble, though, since some things in the framework assume that this is the case.

提交回复
热议问题