[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 444
  • Last Modified:

how i can set selectedIndex for LinkBar

Hi Expert,

I am trying  to set totalPages to LinkBar selectedIndex.
linkAC.selectedIndex = totalPages;
But giving error like access to undefined property selectedIndex.
Could you please tell how i can set?
  • 2
1 Solution
Pravin AsarCommented:
You post your code.

Look at this one. try with Flex3 Builder.

      <mx:ArrayCollection id="lnkData">
                  <mx:Object display="Apple" value="value1" link="http://www.apple.com"/>
                  <mx:Object display="Adobe" value="value2" link="http://www.adobe.com"/>
                  <mx:Object display="Google" value="value4" link="http://www.google.com"/>
                  <mx:Object display="Microsoft" value="value3" link="http://www.microsoft.com"/>
                  <mx:Object display="Yahoo" value="value1" link="http://www.yahoo.com"/>
                  <mx:Object display="Oracle" value="value5" link="http://www.oracle.com"/>
      <mx:LinkBar id="lb" dataProvider="{lnkData}" labelField="display" itemClick="trace(lb.selectedIndex); trace(lnkData.getItemAt(lb.selectedIndex).link.toString()); "/>
Pravin AsarCommented:
Forgot to set default

      <mx:LinkBar id="lb" dataProvider="{lnkData}" labelField="display" selectedIndex="1" itemClick="trace(lb.selectedIndex); trace(lnkData.getItemAt(lb.selectedIndex).link.toString()); "/>
AlpitaAuthor Commented:
Thank you!

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now