Flex4 flash builder保留MXML转换的AS代码

和弘博
2023-12-01

Flex4 flash builder保留MXML转换的AS代码

项目->属性->Flex编译器 | 附加的编译参数 加上 -keep

生成的Test005-interface.as文件:

package 
{
import flash.accessibility.*;
import flash.debugger.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
import mx.binding.*;
import mx.core.ClassFactory;
import mx.core.DeferredInstanceFromClass;
import mx.core.DeferredInstanceFromFunction;
import mx.core.IDeferredInstance;
import mx.core.IFactory;
import mx.core.IFlexModuleFactory;
import mx.core.IPropertyChangeNotifier;
import mx.core.mx_internal;
import mx.filters.*;
import mx.styles.*;
import spark.components.Application;
import spark.components.Label;
import spark.components.Application;
import mx.controls.DateField;
import mx.controls.Tree;
import mx.collections.ArrayList;
import spark.components.gridClasses.GridColumn;
import Object;
import spark.components.DataGrid;
import spark.components.Button;

public class Test005 extends spark.components.Application
{
    public function Test005() {}


    mx_internal var _bindings : Array;
    mx_internal var _watchers : Array;
    mx_internal var _bindingsByDestination : Object;
    mx_internal var _bindingsBeginWithWord : Object;


}}

生成的Test005-generated.as文件:

/**
 *  Generated by mxmlc 4.0
 *
 *  Package:    
 *  Class:      Test005
 *  Source:     D:\Thinkpad\adobeTraining\f4dria\_ws\TestFlex4\src\Test005.mxml
 *  Template:   flex2/compiler/mxml/gen/ClassDef.vm
 *  Time:       2015.11.26 09:32:15 CST
 */

package 
{

import flash.accessibility.*;
import flash.debugger.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
import mx.binding.*;
import mx.collections.ArrayList;
import mx.controls.DateField;
import mx.controls.Tree;
import mx.core.ClassFactory;
import mx.core.DeferredInstanceFromClass;
import mx.core.DeferredInstanceFromFunction;
import mx.core.IDeferredInstance;
import mx.core.IFactory;
import mx.core.IFlexModuleFactory;
import mx.core.IPropertyChangeNotifier;
import mx.core.mx_internal;
import mx.filters.*;
import mx.styles.*;
import spark.components.Application;
import spark.components.Button;
import spark.components.DataGrid;
import spark.components.Label;
import spark.components.gridClasses.GridColumn;


[Frame(extraClass="_Test005_FlexInit")]

[Frame(factoryClass="_Test005_mx_managers_SystemManager")]


//  begin class def
public class Test005
    extends spark.components.Application
{

    //  instance variables

    //  type-import dummies



    //  constructor (Flex display object)
    /**
     * @private
     **/
    public function Test005()
    {
        super();

        mx_internal::_document = this;




        // layer initializers

       
        // properties
        this.mxmlContentFactory = new mx.core.DeferredInstanceFromFunction(_Test005_Array1_c);


        // events












    }

    /**
     * @private
     **/ 
    private var __moduleFactoryInitialized:Boolean = false;

    /**
     * @private
     * Override the module factory so we can defer setting style declarations
     * until a module factory is set. Without the correct module factory set
     * the style declaration will end up in the wrong style manager.
     **/ 
    override public function set moduleFactory(factory:IFlexModuleFactory):void
    {
        super.moduleFactory = factory;
        
        if (__moduleFactoryInitialized)
            return;

        __moduleFactoryInitialized = true;


        // our style settings


        // ambient styles
        mx_internal::_Test005_StylesInit();

                         
    }
 
    //  initialize()
    /**
     * @private
     **/
    override public function initialize():void
    {


        super.initialize();
    }


    //  scripts
    //  end scripts


    //  supporting function definitions for properties, events, styles, effects
private function _Test005_Array1_c() : Array
{
    var temp : Array = [_Test005_Button1_c(), _Test005_Label1_c(), _Test005_DataGrid1_c(), _Test005_DateField1_c(), _Test005_Tree1_c()];
    return temp;
}

private function _Test005_Button1_c() : spark.components.Button
{
    var temp : spark.components.Button = new spark.components.Button();
    temp.x = 122;
    temp.y = 94;
    temp.label = "按钮";
    if (!temp.document) temp.document = this;
    return temp;
}

private function _Test005_Label1_c() : spark.components.Label
{
    var temp : spark.components.Label = new spark.components.Label();
    temp.x = 122;
    temp.y = 149;
    temp.text = "标签";
    if (!temp.document) temp.document = this;
    return temp;
}

private function _Test005_DataGrid1_c() : spark.components.DataGrid
{
    var temp : spark.components.DataGrid = new spark.components.DataGrid();
    temp.x = 245;
    temp.y = 94;
    temp.requestedRowCount = 4;
    temp.columns = _Test005_ArrayList1_c();
    temp.typicalItem = {dataField1: "示例数据", dataField2: "示例数据", dataField3: "示例数据"};
    temp.dataProvider = _Test005_ArrayList2_c();
    if (!temp.document) temp.document = this;
    return temp;
}

private function _Test005_ArrayList1_c() : mx.collections.ArrayList
{
    var temp : mx.collections.ArrayList = new mx.collections.ArrayList();
    temp.source = [_Test005_GridColumn1_c(), _Test005_GridColumn2_c(), _Test005_GridColumn3_c()];
    return temp;
}

private function _Test005_GridColumn1_c() : spark.components.gridClasses.GridColumn
{
    var temp : spark.components.gridClasses.GridColumn = new spark.components.gridClasses.GridColumn();
    temp.dataField = "dataField1";
    temp.headerText = "列 1";
    return temp;
}

private function _Test005_GridColumn2_c() : spark.components.gridClasses.GridColumn
{
    var temp : spark.components.gridClasses.GridColumn = new spark.components.gridClasses.GridColumn();
    temp.dataField = "dataField2";
    temp.headerText = "列 2";
    return temp;
}

private function _Test005_GridColumn3_c() : spark.components.gridClasses.GridColumn
{
    var temp : spark.components.gridClasses.GridColumn = new spark.components.gridClasses.GridColumn();
    temp.dataField = "dataField3";
    temp.headerText = "列 3";
    return temp;
}

private function _Test005_ArrayList2_c() : mx.collections.ArrayList
{
    var temp : mx.collections.ArrayList = new mx.collections.ArrayList();
    temp.source = [{dataField1: "数据1", dataField2: "数据1", dataField3: "数据1"}, {dataField1: "数据2", dataField2: "数据2", dataField3: "数据2"}, {dataField1: "数据3", dataField2: "数据3", dataField3: "数据3"}, {dataField1: "数据4", dataField2: "数据4", dataField3: "数据4"}];
    return temp;
}

private function _Test005_DateField1_c() : mx.controls.DateField
{
    var temp : mx.controls.DateField = new mx.controls.DateField();
    temp.x = 245;
    temp.y = 231;
    if (!temp.document) temp.document = this;
    return temp;
}

private function _Test005_Tree1_c() : mx.controls.Tree
{
    var temp : mx.controls.Tree = new mx.controls.Tree();
    temp.x = 490;
    temp.y = 94;
    if (!temp.document) temp.document = this;
    return temp;
}



    //  initialize style defs for Test005

    mx_internal var _Test005_StylesInit_done:Boolean = false;

    mx_internal function _Test005_StylesInit():void
    {
        //  only add our style defs to the style manager once
        if (mx_internal::_Test005_StylesInit_done)
            return;
        else
            mx_internal::_Test005_StylesInit_done = true;
            
        var style:CSSStyleDeclaration;
        var effects:Array;
                    

        var conditions:Array;
        var condition:CSSCondition;
        var selector:CSSSelector;

        styleManager.initProtoChainRoots();
    }


    //  embed carrier vars
    //  end embed carrier vars


//  end class def
}

//  end package def
}

 

 类似资料: