Actionscript 3 错误:无法解析<;mx:列>;到一个组件实现
我在flashweb应用程序编译时遇到了这个错误Actionscript 3 错误:无法解析<;mx:列>;到一个组件实现,actionscript-3,apache-flex,flex3,itemrenderer,advanceddatagrid,Actionscript 3,Apache Flex,Flex3,Itemrenderer,Advanceddatagrid,我在flashweb应用程序编译时遇到了这个错误 Error: Could not resolve <mx:columns> to a component implementation. 错误:无法解析为组件实现。 这里是过去的版本(它可以编译) 现在我想把它改成以下内容 //In ActionScript package widgets { import mx.controls.AdvancedDataGrid; public class CustomAdvancedDa
Error: Could not resolve <mx:columns> to a component implementation.
错误:无法解析为组件实现。
这里是过去的版本(它可以编译)
现在我想把它改成以下内容
//In ActionScript
package widgets
{
import mx.controls.AdvancedDataGrid;
public class CustomAdvancedDataGrid extends AdvancedDataGrid
{
public function CustomAdvancedDataGrid()
{
}
override protected function measure():void
{
super.measure();
if(this.dataProvider != null && this.dataProvider.length > 0)
{
this.measuredHeight = this.measureHeightOfItems(0, dataProvider.length);
}
}
}
}
// In Modified mxml to use the subclass
<?xml version="1.0" encoding="utf-8"?>
<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:customWidgets="widgets.*"
verticalScrollPolicy="auto">
<customWidgets:CustomAdvancedDataGrid id="myDataGrid"
width="100%"
showHeaders="false"
includeInLayout="{myDataGrid.visible}"
defaultLeafIcon="{null}"
horizontalGridLines="true"
verticalGridLines="true"
horizontalGridLineColor="#E4E4E4"
verticalGridLineColor="#E4E4E4"
rowCount="6"
minHeight="94"
variableRowHeight="true"
selectable="false"
>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Property" headerText="Property" backgroundColor="#E5EFF5" width="0.5" wordWrap="true"/>
<mx:AdvancedDataGridColumn dataField="Value" headerText="Value" backgroundColor="white" width="0.5" itemRenderer="MyCustomRenderer"/>
<mx:AdvancedDataGridColumn dataField="RowIdentifier" visible="false"/>
</mx:columns>
</customWidgets:CustomAdvancedDataGrid>
</mx:Box>
//在ActionScript中
包小部件
{
导入mx.controls.AdvancedDataGrid;
公共类CustomAdvancedDataGrid扩展了AdvancedDataGrid
{
公共函数CustomAdvancedDataGrid()
{
}
重写受保护的函数度量值():void
{
super.measure();
if(this.dataProvider!=null&&this.dataProvider.length>0)
{
this.measuredHeight=this.measureHeightoItems(0,dataProvider.length);
}
}
}
}
//在修改的mxml中使用子类
我已经按照另一个stackoverflow链接中的建议将mx.swc添加到Flex编译器路径中,但这没有帮助
非常感谢您的帮助。由于您的AdvancedDataGrid子类位于不同的命名空间中,因此
列成员需要位于相同的命名空间中:
<customWidgets:CustomAdvancedDataGrid ...>
<customWidgets:columns>
<mx:AdvancedDataGridColumn ...>
</customWidgets:columns>
</customWidgets:CustomAdvanceDataGrid>
有人能建议如何在actionscript中实现这一点吗?非常感谢。成功了。但是列仍然在mx名称空间中,对吗?你是说AdvancedDataGridColumn元素?是的,它们仍然在mx名称空间中。
<customWidgets:CustomAdvancedDataGrid ...>
<customWidgets:columns>
<mx:AdvancedDataGridColumn ...>
</customWidgets:columns>
</customWidgets:CustomAdvanceDataGrid>