0

有多个模块项目,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/Error-Instantiation-attempted-on-a-non-constructor.aspx 看来我只需要将特殊样式编译到我的应用程序中。我做到了(A引用了样式文件)编译成功,运行,依然存在错误。我想也许应用程序无法将 css 编译为 swf,所以我将一些编译 css 脚本添加到 maven pom.xml

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

仍然弹出错误。

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

4

1 回答 1

0

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

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>
于 2012-07-05T07:22:40.907 回答