That seems like a complicated and difficult way to do it.

 

Why not just loop over tabArray, comparing your value to tabLabel, and
when you match, use that loop index to set the selected index.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Mic
Sent: Sunday, November 02, 2008 12:54 PM
To: [email protected]
Subject: [flexcoders] Re: change selected tab using variable containing
tab label string?

 

Tried that - I think :-)

public function createTabList():void {
for each (var node:XML in _paraSightDataset.tab) {
var newItem:Object = new Object();
newItem.tabLabel = [EMAIL PROTECTED] <mailto:node.%40label.toString>
();
newItem.name = newItem.tabLabel;
tabArray.addItem(newItem);
}

myTabBar.dataProvider = tabArray;

}

private function
traceDisplayList(container:DisplayObjectContainer,indentString:String =
""):void
{
var child:DisplayObject;
for (var i:uint=0; i < container.numChildren; i++)
{
child = container.getChildAt(i);
trace(indentString, child, child.name);
if (container.getChildAt(i) is DisplayObjectContainer)
{
traceDisplayList(DisplayObjectContainer(child),
indentString + " ")
}
}
}

traceDisplayList(myTabBar);

parasight0.appPanel.appBox.HBox29.myTabBar.Tab84 Tab84
parasight0.appPanel.appBox.HBox29.myTabBar.Tab84.upSkin upSkin
parasight0.appPanel.appBox.HBox29.myTabBar.Tab84.selectedUpSkin
selectedUpSkin
parasight0.appPanel.appBox.HBox29.myTabBar.Tab84.UITextField85
UITextField85
parasight0.appPanel.appBox.HBox29.myTabBar.Tab86 Tab86
parasight0.appPanel.appBox.HBox29.myTabBar.Tab86.upSkin upSkin
parasight0.appPanel.appBox.HBox29.myTabBar.Tab86.UITextField87
UITextField87
parasight0.appPanel.appBox.HBox29.myTabBar.Tab88 Tab88
parasight0.appPanel.appBox.HBox29.myTabBar.Tab88.upSkin upSkin
parasight0.appPanel.appBox.HBox29.myTabBar.Tab88.overSkin overSkin
parasight0.appPanel.appBox.HBox29.myTabBar.Tab88.UITextField89
UITextField89
parasight0.appPanel.appBox.HBox29.myTabBar.Tab90 Tab90
parasight0.appPanel.appBox.HBox29.myTabBar.Tab90.upSkin upSkin
parasight0.appPanel.appBox.HBox29.myTabBar.Tab90.UITextField91
UITextField91
parasight0.appPanel.appBox.HBox29.myTabBar.Tab92 Tab92
parasight0.appPanel.appBox.HBox29.myTabBar.Tab92.upSkin upSkin
parasight0.appPanel.appBox.HBox29.myTabBar.Tab92.UITextField93
UITextField93

So childName is set internally? Wonder how one would even use
myTabBar.getChildByName()? Maybe I am missing something? TIA,

Mic

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Ralf Bokelberg" <[EMAIL PROTECTED]>
wrote:
>
> Maybe you can add name="{label}" to the children?
>
> Ralf.
>
> On Sun, Nov 2, 2008 at 11:20 AM, Mic [EMAIL PROTECTED] wrote:
> > myTabBar.selectedIndex =
> > myTabBar.getChildIndex(myTabBar.getChildByName(e.label)); does not
> > work because the child name is not the tab label text. How would I
do
> > this? TIA,
> >
> > Mic.
> >
> >
>

 

Reply via email to