Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Is it possible to dynamically add children to a TabNavigator from a Repeater in FLEX 3?

Posted on 2009-05-11
9
Medium Priority
?
2,465 Views
Last Modified: 2012-05-06
Is it possible to dynamically add children to a tabnavigator from a repeater in Flex 3?

If Yes, can you provide an example?

Thanks!
0
Comment
Question by:20lbMonkey
  • 6
  • 3
9 Comments
 
LVL 19

Expert Comment

by:Jones911
ID: 24359892
Not sure what you mean.  But you can write a loop and dynamically add Tabs to a tab navigator to say add 3 tads at once?
0
 

Author Comment

by:20lbMonkey
ID: 24359913
Except do it in using an MXML component and a repeater.

Like this:

<mx:Repeater id="prodRepeater"
      width="100%" height="100%"
      dataProvider="{prodEditArray}">
      <v:ProductEditDetail id="prod"
           width="130" height="100%"
           productEditsItem="{prodRepeater.currentItem}"/>
</mx:Repeater>

Based on the results from the repeater, i want to dynamically add tabs to a tabnavigator based on the number of items returned from this snippet.

Does that make sense?
0
 

Author Comment

by:20lbMonkey
ID: 24360057
You can probably tell by my questions that i am pretty new. Would the TabBar work in this situation?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:Jones911
ID: 24360191
I'm just not understanding why you need to do this.  You can loop over prodEditArray and add tabs I do'nt know why this needs to be in a repeater.
0
 

Author Comment

by:20lbMonkey
ID: 24360218
Actually, it doesnt have to be.

So, you are saying that you would recommend looping through the prodEditArray in ActionScript and dynamically create the child tabs?

If yes, then would you fully add the tab navigator child tabs before adding the controls to each tab or do it at the time of the creation?

Thanks for your help!

0
 
LVL 19

Accepted Solution

by:
Jones911 earned 2000 total points
ID: 24360230
This is what I think your doign let me know if I'm off.

Lets say you have a bunch on students in the array.  You click on a student then for that student want to add all the Classes they are enrolled in into seperated tabs.  This si just and example but I think its the "type" of end result your after.

In this case I would loop over the array and add the tabs and in each tab add the items you want for that tab.  I would add the items into a vbox ( or whatever u want ) then add that into the tab and add the tab to the navagator.
0
 

Author Comment

by:20lbMonkey
ID: 24365535
Thanks for the quick overview. It really  helped to send me down the right path of reading and coding.

Here is what I wrote:

for (var i:int = 0; i < prodEditArray.length; i++)
{
      var source:String = new String();                              var _canvas:Canvas = new Canvas();
      var _label:Label = new Label();
      var _image:Image = new Image();                        

      _label.text = prodEditArray[i].labelID
      _image.source = prodEditArray[i].imageDir + prodEditArray[i].imageName;
                     _canvas.addChild(_label);
                     _canvas.addChild(_image);                        
                              
      this.TabEdit.addChild(_canvas);                        
}

It is loading and working pretty slick. My only issue now is that I cannot get the _lable to populate on the TabNavigator. I wants to add it inside of the canvas and the Image overwrites it.

Is there a different control that I should be looking at to pupulate the TabNavigator.label?

Thanks again for your help!      
0
 

Author Comment

by:20lbMonkey
ID: 24365770
Scratch that, after i sent the last message, I figured out what i was doing wrong.

Here is the code that worked.

for (var i:int = 0; i < prodEditArray.length; i++)
{
      var source:String = new String();      
                     var _canvas:Canvas = new Canvas();                  
      var _image:Image = new Image();      
                              
      _image.source = prodEditArray[i].imageDir + prodEditArray[i].imageName;                              
      _canvas.label = prodEditArray[i].labelID;
      _canvas.addChild(_image);                        
                              
      this.TabEdit.addChild(_canvas);                                    
}
0
 

Author Closing Comment

by:20lbMonkey
ID: 31580359
Thanks for you guidance!
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question