Solved

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

Posted on 2009-05-11
9
2,408 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
Comment Utility
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
Comment Utility
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
Comment Utility
You can probably tell by my questions that i am pretty new. Would the TabBar work in this situation?
0
 
LVL 19

Expert Comment

by:Jones911
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:20lbMonkey
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for you guidance!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Veeam Backup & Replication has added a new integration – Veeam Backup for Microsoft Office 365.  In this blog, we will discuss how you can benefit from Office 365 email backup with the Veeam’s new product and try to shed some light on the needs and …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now