Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-21-2010, 06:16 PM   #1
Senior Member
Join Date: Nov 2002
Location: CA
Posts: 454
Default Display component from a repeater var?

I have an array of objects I would like to use in a repeater component. One of the fields in the objects refers to the id of a component defined in the <fxeclarations> tag.

Trouble is, I have no clue how to get it to display:

ActionScript Code:
<?xml version="1.0" encoding="utf-8"?> <s:Group xmlns:ns1="*"          xmlns:fx="http://ns.adobe.com/mxml/2009"          xmlns:s="library://ns.adobe.com/flex/spark"          xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">         <fx:Declarations>         <ns1:CustomOne id="foo" />         <ns1:CustomTwo id="bar" />         <ns1:CustomThree id="snafu" />     </fx:Declarations>             <fx:Script>         <![CDATA[                         [Bindable] public var modules:Array;                         public function init():void {                 modules = [                     {module:foo, label:"Foo"},                     {module:bar, label:"Bar"},                     {module:snafu, label:"Snafu"},                 ];                    }                     ]]>         </fx:Script>         <mx:TabNavigator>                  <mx:Repeater id="tabs" dataProvider="{modules}">             <s:NavigatorContent label="{tabs.currentItem.label}" >                 {tabs.currentItem.module}             </s:NavigatorContent>         </mx:Repeater>     </mx:TabNavigator> </s:Group>

I tried using NavigatorContent.contentGroup too but nothing happened.

Arodicus is offline   Reply With Quote
Old 10-21-2010, 09:30 PM   #2
Senior Member
Join Date: Nov 2002
Location: CA
Posts: 454
Cool Solved

Solved after a few hours of head banging...

ActionScript Code:
<mx:TabNavigator>              <mx:Repeater id="tabs" dataProvider="{modules}">         <s:NavigatorContent             id="tabby"             initialize="tabby[tabs.currentIndex].addElement(tabs.currentItem.module)"               label="{tabs.currentItem.label}" />     </mx:Repeater> </mx:TabNavigator>

The trick was to assign an id and then have the repeater instance refer to itself in the initializer.
Arodicus is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 01:53 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.