0
我在中繼器中有一個自定義組件。該組件有一個子組件,根據某些條件它可以是兩種類型。我所做的是使用UIComponent作爲佔位符。在中繼器中更改另一個組件中的子組件
在重複組件,可以說RepeatedComponent:
<mx:VBox>
<mx:UIComponent id="placeHolder"/>
</mx:VBox>
而且具有中繼我這樣做是在組件:
// Function where I try to inject the child component :
private function getComponent():UIComponent{
if(condition)
{
return new ChildComponentA();
}
else
{
return new ChildComponentB();
}
]]>
</mx:Script>
<mx:VBox>
<mx:Repeater id="repeteur"
recycleChildren="true"
dataProvider="{arrayBeneficiaires}" >
<components:RepeatedComponent id="repeatedComponent"
beneficiaire="{repeteur.currentItem}"
placeHolder="{getComponent()}"/>
</mx:Repeater>
</mx:VBox>
當我把在叫在creationComplete功能斷點,我可以看到分配給placeHolder的組件是正確的,但它不顯示在我的顯示器上。我在每個我能想到的地方調用invalidateDisplayList來嘗試刷新,但它似乎不起作用。 任何想法將是最受歡迎的。
感謝
明確加上孩子確實是解決方案。謝謝! – Sandy 2010-11-11 03:27:32