You can provide a dataprovider to LinkBar in the following way
<?xml version="1.0"?>
<!-- controls\bar\LBarSimple.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:LinkBar borderStyle="solid"
itemClick="navigateToURL(new URLRequest('http://
www.adobe.com/' +
String(event.label).toLowerCase()), '_blank');">
<mx:dataProvider>
<mx:String>Flash</mx:String>
<mx:String>Director</mx:String>
<mx:String>Dreamweaver</mx:String>
<mx:String>ColdFusion</mx:String>
</mx:dataProvider>
</mx:LinkBar>
</mx:Application>
But to associate a ViewStack to a linkbar you can`t write the code as
in your code2 sample.
On Nov 1, 10:26 pm, "Venkat Viswanathan" <[EMAIL PROTECTED]>
wrote:
> Hi Rajan,
>
> Linkbar accepts Array/ArrayCollection of String as dataprovider. Check out
> LiveDocs for implementation of LinkBar. And you will have to keep the
> ViewStack in a similar way as in Code1. And write a fresh code for LinkBar
> something like this:
>
> <?xml version="1.0"?>
> <!-- controls\bar\LBarBinding.mxml -->
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
>
> <mx:Script>
> <![CDATA[
> import mx.collections.ArrayCollection;
>
> [Bindable]
> private var linkData:ArrayCollection = new ArrayCollection([
> "Flash", "Director", "Dreamweaver", "ColdFusion"
> ]);
> ]]>
> </mx:Script>
>
> <mx:LinkBar
> horizontalAlign="right"
> borderStyle="solid"
> itemClick="navigateToURL(new URLRequest('http://www.adobe.com/'+
> String(event.label).toLowerCase()), '_blank');">
> <mx:dataProvider>
> {linkData}
> </mx:dataProvider>
> </mx:LinkBar>
> </mx:Application>
>
> In the above example, change the way click is handled in itemClick event to
> change the selectedIndex of the ViewStack.
>
> Regards,
> Venkatwww.venkatv.com
>
>
>
> On Sat, Nov 1, 2008 at 4:45 AM, ilikeflex <[EMAIL PROTECTED]> wrote:
>
> > Hi
>
> > I have below sample code(Code1) which is working fine and i have
> > taken from livedocs. Now i have made modification to code1 and
> > changed to code2.
>
> > In code2 i am declaring the dataprovider property of the linkbar in a
> > different way.I am using the <mx:dataProvider> tag.In this case
> > linkbar does not show viewstack contents.
>
> > I have been putting my head into this but could not find any solution.
> > Any pointers are highly appreciated.
>
> > Thanks
> > Rajan
>
> > Code1:
> > <?xml version="1.0"?>
> > <!-- Simple example to demonstrate the LinkBar control. -->
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
>
> > <mx:Panel title="LinkBar Control Example"
> > height="75%" width="75%" horizontalAlign="center"
> > paddingTop="10" paddingBottom="10" paddingLeft="10"
> > paddingRight="10">
>
> > <mx:LinkBar color="#0000FF" fontWeight="bold"
> > dataProvider="{myViewStack}"/>
>
> > <!-- Define the ViewStack and the two child containers. -->
> > <mx:ViewStack id="myViewStack" borderStyle="solid"
> > width="100%" height="80%">
>
> > <mx:Canvas id="search" backgroundColor="#FFFFCC"
> > label="Search" width="100%" height="100%">
> > <mx:Label text="Search Screen" color="#000000"/>
> > </mx:Canvas>
>
> > <mx:Canvas id="custInfo" backgroundColor="#CCFFFF"
> > label="Customer Info" width="100%" height="100%">
> > <mx:Label text="Customer Info" color="#000000"/>
> > </mx:Canvas>
>
> > <mx:Canvas id="accountInfo" backgroundColor="#FFCCFF"
> > label="Account Info" width="100%" height="100%">
> > <mx:Label text="Account Info" color="#000000"/>
> > </mx:Canvas>
> > </mx:ViewStack>
>
> > </mx:Panel>
> > </mx:Application>
>
> > Code2:
> > <?xml version="1.0"?>
> > <!-- Simple example to demonstrate the LinkBar control. -->
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
>
> > <mx:Panel title="LinkBar Control Example"
> > height="75%" width="75%" horizontalAlign="center"
> > paddingTop="10" paddingBottom="10" paddingLeft="10"
> > paddingRight="10">
>
> > <mx:LinkBar color="#0000FF" fontWeight="bold">
> > <mx:dataProvider>
> > <!-- Define the ViewStack and the two child containers. -->
> > <mx:ViewStack id="myViewStack" borderStyle="solid"
> > width="100%" height="80%">
> > <mx:Canvas id="search" backgroundColor="#FFFFCC"
> > label="Search" width="100%" height="100%">
> > <mx:Label text="Search Screen" color="#000000"/>
> > </mx:Canvas>
>
> > <mx:Canvas id="custInfo" backgroundColor="#CCFFFF"
> > label="Customer Info" width="100%" height="100%">
> > <mx:Label text="Customer Info" color="#000000"/>
> > </mx:Canvas>
>
> > <mx:Canvas id="accountInfo" backgroundColor="#FFCCFF"
> > label="Account Info" width="100%" height="100%">
> > <mx:Label text="Account Info" color="#000000"/>
> > </mx:Canvas>
> > </mx:ViewStack>
> > </mx:dataProvider>
> > </mx:LinkBar>
> > </mx:Panel>
> > </mx:Application- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---