Adobe Dreamweaver Forums



Last 10 THreads :         Can't get Macromedia Authorware Web Player to install onWindows Vista (Last Post : Steve Howard **Community Expert** - eLearning + Mo - Replies : 1 - Views : 2 )           »          Can I make a 4 state CSS Sprite nav bar. (Last Post : Team Liquid Fire - Replies : 8 - Views : 9 )           »          3 overlapping background images on same page (Last Post : brad_goldstein - Replies : 10 - Views : 11 )           »          fireworks exports hundreds of files (Last Post : JoeyD1978 - Replies : 1 - Views : 2 )           »          DW or FW? (Last Post : JoeyD1978 - Replies : 1 - Views : 2 )           »          cfdocument printing issues: cf7 vs cf8 (Last Post : k43 - Replies : 1 - Views : 2 )           »          wont work in IE (Last Post : ckovy - Replies : 2 - Views : 3 )           »          Re: CS4 GPU Acceleration and Intel X3100 (Last Post : Intel - Replies : 0 - Views : 1 )           »          cs4 full screen mode isn't saved in workspaces, unlike cs3 (Last Post : eddie caruso - Replies : 2 - Views : 3 )           »          Problem with Subversion (Last Post : tmortime - Replies : 0 - Views : 1 )           »         


User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-04-2008, 09:02 AM
ForestDemon
 
Posts: n/a
Diggs:
Default How can I get the current/active index of a tab within aTabNavigator?

I would think it was something as simple as: var whichTab:int =
tabNav.selectedIndex();

Do I have to wire a change event to the tabs and keep track of it through a
public variable, er something of the like?

Thanks folks...

-fd



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-04-2008, 09:02 AM
Greg Lafrance
 
Posts: n/a
Diggs:
Default Re: How can I get the current/active index of a tabwithin a TabNavigator?

Here's some wierd code that works:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:TabNavigator id="tab" width="400">
<mx:VBox id="one" label="Tab One">
<mx:Label text="Index of currently displayed tab: {tab.selectedIndex}"
fontSize="20"/>
</mx:VBox>
<mx:VBox id="two" label="Tab Two">
<mx:Label text="Index of currently displayed tab: {tab.selectedIndex}"
fontSize="20"/>
</mx:VBox>
<mx:VBox id="three" label="Tab Three">
<mx:Label text="Index of currently displayed tab: {tab.selectedIndex}"
fontSize="20"/>
</mx:VBox>
<mx:VBox id="four" label="Tab Four">
<mx:Label text="Index of currently displayed tab: {tab.selectedIndex}"
fontSize="20"/>
</mx:VBox>
</mx:TabNavigator>
</mx:Application>

Reply With Quote
  #3 (permalink)  
Old 11-04-2008, 09:02 AM
ForestDemon
 
Posts: n/a
Diggs:
Default Re: How can I get the current/active index of a tabwithin a TabNavigator?

sorry, after reading my post i could have been more clear.

i'm trying to capture an event from a navigation component within a tab of the
tabnavigator.

i.e. a click of the "Next" would tabNav.selectedIndex++ or "Prev" would
tabNav.selectedIndex--

i would also obviously need to check for tab count to avoid runtime errors,
but i'm just trying to capture the component event which consists of a prev and
next button.

thanks...

-fd


Reply With Quote


  #4 (permalink)  
Old 11-04-2008, 09:02 AM
-Hob
 
Posts: n/a
Diggs:
Default Re: How can I get the current/active index of a tabwithin a TabNavigator?

So your problem is basically trying to figure out which parent is the tab
navigator? This is a common problem in flex. The easiest way to accomplish
what you're trying to do is use the model locator pattern.

Basically what you do is create a bindable static var on a class called
"ModelLocator" or something similar, then you bind the TavNavigator's
selectedIndex property to that bindable var:

<TabNavigator selectedIndex={ModelLocator.selectedIndex}/>

Then whenever you want the tabnavigator to switch tabs, simply updated the
static var on your modellocator.

Reply With Quote
  #5 (permalink)  
Old 11-04-2008, 09:02 AM
Greg Lafrance
 
Posts: n/a
Diggs:
Default Re: How can I get the current/active index of a tabwithin a TabNavigator?

Okay, so in the code that I provided, instead of Labels have buttons, Next and
Previous, and have a click listener that does tab.selectedIndex++ or
tab.selectedIndex-- and also checks if the new index is 0 ("Previous" button
enabled property to false) or if the new index is tab.numChildren-1
("Next" button enabled property to false).

Reply With Quote
  #6 (permalink)  
Old 11-04-2008, 09:02 AM
ForestDemon
 
Posts: n/a
Diggs:
Default Re: How can I get the current/active index of a tabwithin a TabNavigator?

Thanks for the input guys. My issue was the component i setup. it consisted of the two nav buttons in question and i didn't have them dispatching the right way in the component itself.

-fd
Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 01:54 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk