在mxml中操作组件添加的覆盖内容

时间:2013-02-19 16:07:53

标签: flex

我有以下mxml代码:( MDI类扩展了Group)

<uiframe:MDI id="mdi" >
    <s:DataGrid />
    <s:DataGrid x="200" />
</uiframe:MDI>

基本上我想用Panel替换DataGrids ,包含DataGrid。

我认为这会有所帮助:(在MDI中)

public override function addElement(element:IVisualElement):IVisualElement{
    replace(element); //replace does not get called
    return element;
}

但是在通过MXML添加时不会调用它。

更新:现在可以使用,但我不认为这是最佳解决方案。

override protected function createChildren():void
{
    for(var i:int = 0; i < super.numElements; i++){
        var e:IVisualElement = removeElementAt(0);
        addMyType(e); //converts to what I want..
    }
    super.createChildren();         
}

0 个答案:

没有答案