[英]How do I create a custom Flex component that accepts elements inside it?
I have the following code (exerpt): 我有以下代码(摘录):
<fx:Declarations>
<fx:Array id="ribbonTabs">
<fx:String>Home</fx:String>
<fx:String>Help</fx:String>
</fx:Array>
</fx:Declarations>
<cx:RibbonBar id="mainRibbon" tabs="{ribbonTabs}" />
The RibbonBar is a custom component I made, that basically has a TabNavigator in it and some other stuff. RibbonBar是我制作的一个自定义组件,基本上在其中包含TabNavigator和其他一些东西。 That code creates this:
该代码创建了这个:
As you can see, I'm using a public variable for the "tabs" property, but I want to write code so that I can do this: 如您所见,我为“ tabs”属性使用了一个公共变量,但是我想编写代码以便执行此操作:
<cx:RibbonBar id="mainRibbon">
<fx:ArrayList>
<fx:String>Home</fx:String>
<fx:String>Help</fx:String>
</fx:ArrayList>
</cx:RibbonBar>
...which would then create the same thing as the screenshot above. ...然后将创建与上面的屏幕快照相同的内容。
How can I achieve this in Adobe Flex 4+? 如何在Adobe Flex 4+中实现此目的? I'm really new to Flex so I would really appreciate commented code or some elaboration on the answers.
我对Flex真的很陌生,因此非常感谢注释的代码或对答案的详尽阐述。 Thanks!
谢谢!
Assuming your "tabs" is similar to the "Dataprovider", your code can be updated like this: 假设您的“标签”类似于“ Dataprovider”,则可以这样更新代码:
<cx:RibbonBar id="mainRibbon">
<cx:tabs>
<fx:ArrayList>
<fx:String>Home</fx:String>
<fx:String>Help</fx:String>
</fx:ArrayList>
</cx:tabs>
</cx:RibbonBar>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.