flex4 maven compile,TypeError:错误#1007:在非构造函数AdvancedDataGrid上尝试实例化

时间:2012-07-03 07:49:34

标签: maven flex flex4 advanceddatagrid

有多个模块项目,A是应用程序,B,C,D是模块。编译成功,但是当我加载模块B时,弹出错误:

TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at mx.controls.dataGridClasses::DataGridHeader/updateDisplayList()
    at mx.core::UIComponent/validateDisplayList()
    at mx.managers::LayoutManager/validateClient()
    at mx.core::UIComponent/validateNow()
    at mx.controls.dataGridClasses::DataGridBase/updateDisplayList()
    at mx.controls::DataGrid/updateDisplayList()
    at mx.controls.listClasses::ListBase/validateDisplayList()
    at mx.managers::LayoutManager/validateDisplayList()
    at mx.managers::LayoutManager/doPhasedInstantiation()
        at mx.managers::LayoutManager/doPhasedInstantiationCallback()

经过研究得到一些文件: http://blog.flexicious.com/post/Errror-Instantiation-attempted-on-a-non-constructor.aspx 好像我只需要将特殊样式编译到我的应用程序中。我做了(A已经引用了样式文件) 编译成功,运行,仍然存在错误。 我想也许应用程序无法将css编译为swf 所以我将一些编译css脚本添加到maven pom.xml

<buildCssFiles>
  <path>styles/temp.css</path>
</buildCssFiles>

仍然弹出错误。

有没有人遇到同样的问题!

1 个答案:

答案 0 :(得分:0)

一般解决方案, 步骤1:将特殊样式脚本添加到样式文件。

mx|AdvancedDataGrid{
    columnDropIndicatorSkin: ClassReference("mx.skins.halo.DataGridColumnDropIndicator");
    columnResizeSkin: ClassReference("mx.skins.halo.DataGridColumnResizeSkin");
    headerColors: #FFFFFF, #E6E6E6;
    headerDragProxyStyleName: "headerDragProxyStyle";
    headerBackgroundSkin: ClassReference("mx.skins.halo.DataGridHeaderBackgroundSkin");
    headerSeparatorSkin: ClassReference("mx.skins.halo.DataGridHeaderSeparator");
    headerHorizontalSeparatorSkin: ClassReference("mx.skins.halo.AdvancedDataGridHeaderHorizontalSeparator");
    headerStyleName: "advancedDataGridStyles";
    sortArrowSkin: ClassReference("mx.skins.halo.DataGridSortArrow");
    stretchCursor: Embed(source="Assets.swf",symbol="cursorStretch");
}

mx|AdvancedDataGridSortItemRenderer{
    paddingTop: 0;
    paddingBottom: 0;
    paddingLeft: 0;
    paddingRight: 0;
    horizontalGap: 0;
    color: #0B333C;
    icon: ClassReference("mx.skins.halo.DataGridSortArrow");
}

mx|PrintAdvancedDataGrid{
    alternatingItemColors: #FFFFFF, #FFFFFF;
    borderColor: 0;
    columnResizeSkin: ClassReference("mx.skins.halo.DataGridColumnResizeSkin");
    headerColors: #FFFFFF, #FFFFFF;
    headerSeparatorSkin: ClassReference("mx.skins.halo.DataGridHeaderSeparator");
    headerStyleName: "advancedDataGridStyles";
    horizontalGridLineColor: 0;
    horizontalGridLines: true;
    sortArrowSkin: ClassReference("mx.skins.halo.DataGridSortArrow");
    stretchCursor: Embed(source="Assets.swf",symbol="cursorStretch");
    verticalGridLineColor: #000000;
}

mx|PrintOLAPDataGrid{
    alternatingItemColors: #FFFFFF, #FFFFFF;
    borderColor: 0;
    columnResizeSkin: ClassReference("mx.skins.halo.DataGridColumnResizeSkin");
    headerColors: #FFFFFF, #FFFFFF;
    headerSeparatorSkin: ClassReference("mx.skins.halo.DataGridHeaderSeparator");
    headerStyleName: "advancedDataGridStyles";
    horizontalGridLineColor: 0;
    horizontalGridLines: true;
    stretchCursor: Embed(source="Assets.swf",symbol="cursorStretch");
    verticalGridLineColor: #000000;
}

第2步:将脚本添加到pom.xml

<compilerWarnings>
    <show-unused-type-selector-warnings>false</show-unused-type-selector-warnings>
</compilerWarnings>