Solved

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

Posted on 2009-05-11
9
2,427 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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 500 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
calling one function after another 4 310
Flash As3 Swf 3 760
Button sound on mouseover 4 479
Is HTMLLoader class supported on Flash Player runtime for browser deployment? 3 1,111
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…
Arrow Electronics was searching for a KVM  (Keyboard/Video/Mouse) switch that could display on one single monitor the current status of all units being tested on the rack.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 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