Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Regular Contributor
Posts: 56
Registered: ‎02-04-2012
My Device: Blackberry Playbook & Black Berry Bold 2
My Carrier: T-Mobile
Accepted Solution

Flash Builder 4.6 Tabbed App

Hi,

 

I've been experimenting with a TabbedView app.  If I put a button on each of 2 views the views are put in the same view space instead of the other tab.  Is there a way to get the second tab to get focus when the button is pushed?  As it is now the button pushes the view in the first tab.

 

From one view

 

                navigator.popAll();
                navigator.pushView(ListView);

 

From the other view

 

                navigator.popAll();
                navigator.pushView(ItemsView);

 

The second tab does not get used at all.  Everything seems to be done in the first tab.

 

Neil

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Flash Builder 4.6 Tabbed App

Without troubleshooting your source all I can recommend is having a look at Adobe’s documentation on defining tabs located here.


http://help.adobe.com/en_US/flex/mobileapps/WS77c1dbb1bd80d383527e1a6412a8a5d909a-8000.html#WSe11993...

Tim Windsor
Open Source Technical Lead
Regular Contributor
Posts: 56
Registered: ‎02-04-2012
My Device: Blackberry Playbook & Black Berry Bold 2
My Carrier: T-Mobile

Re: Flash Builder 4.6 Tabbed App

That is my source in the button click event.  Other than that the tabs and mxml docs were created when the app was created.

 

Neil

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Flash Builder 4.6 Tabbed App

That documentation says:

 

"Each ViewNavigator maintains a separate navigation stack. Therefore, the ViewNavigator methods, such as pushView() and popView()

, are relative to the currently active section. The back button on the mobile device returns control to the previous view on the stack of the current ViewNavigator. The change of view does not alter the current section."

 

and 


"To change sections programmatically, set the TabbedViewNavigator.selectedIndex

 property to the index of the desired section. Section indexes are 0-based: the first section in the application is at index 0, the second is at index 1, and so on."

 

Have you tried that?

Tim Windsor
Open Source Technical Lead
Regular Contributor
Posts: 56
Registered: ‎02-04-2012
My Device: Blackberry Playbook & Black Berry Bold 2
My Carrier: T-Mobile

Re: Flash Builder 4.6 Tabbed App

There is no selectedIndex in the navigator.  There is a tabindex that can be set to 0 but that does nothing.

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Flash Builder 4.6 Tabbed App

Try "tabbedNavigator.selectedIndex"

 

That's what it appeared as in my sample app, attached.

Tim Windsor
Open Source Technical Lead
Regular Contributor
Posts: 56
Registered: ‎02-04-2012
My Device: Blackberry Playbook & Black Berry Bold 2
My Carrier: T-Mobile

Re: Flash Builder 4.6 Tabbed App

I'm not sure you understand what I was trying to do.  Setup a tabbed app with Tab1 and Tab2.

 

Insert the code for Tab1 and Tab2 below:

 

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
		xmlns:s="library://ns.adobe.com/flex/spark" title="Tab1">
	
	<fx:Script>
		<![CDATA[
			import spark.components.ViewMenuItem;
			import spark.components.supportClasses.ViewNavigatorAction;
			import spark.events.ViewNavigatorEvent;
			protected function button1_clickHandler(event:MouseEvent):void
			{
				navigator.tabIndex=1;
				
				
			}
		]]>
	</fx:Script>
	
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:Button x="428" y="488" label="Tab1" click="button1_clickHandler(event)"/>
</s:View>



<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
		xmlns:s="library://ns.adobe.com/flex/spark" title="Tab2">
	
	
	<fx:Script>
		<![CDATA[

			
			protected function button1_clickHandler(event:MouseEvent):void
			{
				
				navigator.tabIndex=0;

			}
		]]>
	</fx:Script>
	
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:Button x="292" y="274" label="Tab2" click="button1_clickHandler(event)"/>
</s:View>

 

 

 

Neil

 

Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Flash Builder 4.6 Tabbed App

You're right, I'm doing a lot of guessing to figure out what you are doing to recreate it here. What is the rest of your application?

Tim Windsor
Open Source Technical Lead
Regular Contributor
Posts: 56
Registered: ‎02-04-2012
My Device: Blackberry Playbook & Black Berry Bold 2
My Carrier: T-Mobile

Re: Flash Builder 4.6 Tabbed App

Hi Tim,

 

I was just trying to see if the tabs could be accessed via code instead of clicking on the bottom bar.  It wasn't being used in an application just for self learning.

 

Here's the scenario.  You have 3 tabs on the bottom of the screen.  Normally you would click each tab to get to the contents of that tab.  I wanted to be able to do it in code rather than have to click on the bottom tab that I wanted to access.  I should be able to do it via the index number for the tab but it does not work.

 

Neil

 

Developer
Posts: 43
Registered: ‎11-19-2010
My Device: Blackberry Tour
My Carrier: Verizon

Re: Flash Builder 4.6 Tabbed App

Try using this:

 

    FlexGlobals.topLevelApplication.tabbedNavigator.selectedIndex = 1;

 

1 being the tab number you want selected in this case