문제

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. That code creates this:

enter image description here

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:

<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+? I'm really new to Flex so I would really appreciate commented code or some elaboration on the answers. Thanks!

도움이 되었습니까?

해결책

Assuming your "tabs" is similar to the "Dataprovider", your code can be updated like this:

<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 ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top