Unable to generate initialization code within Repeater
Problem:
Following error is arising if I use NavigatorContent in Repeater. Is there a way to initialize image and lable on which I am encountering following error:
Unable to generate initialization code within Repeater, due to id or data binding on a component that is not a visual child.
Code:
<mx:Repeater id="rep" d开发者_如何学编程ataProvider="{usersArray}">
<s:NavigatorContent width="100%" height="100%" label="{rep.currentItem.name}" >
<mx:Image x="10" y="10" source="{rep.currentItem.imagePath}" width="175" height="118"/>
<s:Label x="145" y="14" text="{rep.currentItem.name}"/>
<s:Button x="147" y="79" label="Edit User" width="79" height="22" click="currentState='AddUser'"/>
<s:Button x="231" y="79" label="Delete" width="56" height="22"/>
</s:NavigatorContent>
</mx:Repeater>
From the docs:
The NavigatorContent class defines a Spark container that can be used in an MX navigator container, such as the ViewStack, TabNavigator and Accordion containers.
Do not use a NavigatorContent container outside of an MX navigator container.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/NavigatorContent.html
I guess you would want to use a Canvas or a custom component in the Repeater. Or you could use the DataGroup instead of the Repeater.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/DataGroup.html
精彩评论