Hi,

I have a tabBar with a *n amount of children. I'd like to let my user
rollOver each one of the children and call a custom tooltip. The tooltip
will contain a label text coming from my TabBar dataProvider.

Below is what I have so far. It is almost doing what I want but since I'm
looping through the dataProvider and grabbing the name of each one of the
children and the label, it is only creating one tooltip - the last one in
the loop :-(.

How can I change the code, so that I can create a custom tooltip, for each
one of the children in the loop?

The code is below. As always any pointers is highly appreciated!


Tooltip code:
-----------------------

            [Bindable]
            public var aTip:ToolTip;

            public var tab:Tab;

            /* other code omitted for brevity

            private function tb_customTooltip(event:Event):void
            {
                for (var i:uint = 0; i < tb.dataProvider.length; i++)
                {
                    tab = Tab(tb.getChildAt( i ));
                    var tabLabel = myCollectionArray.getItemAt( i
).label;
                }
                    aTip= ToolTipManager.createToolTip(tabLabel,tab.x+75,
                    tab.y+19,"toolTipRight") as ToolTip;

                    aTip.setStyle("styleName", "errorTip");
                    aTip.percentWidth = 100;
                    aTip.percentHeight = 100;
            }

            private function destroyTip( event:Object ):void
            {
                ToolTipManager.destroyToolTip(aTip);
            }


TabBar code:

----------------------

    <mx:TabBar id="tb" dataProvider="{myCollectionArray}"
         width="59"
         right="5"
         direction="vertical"
         alpha="1.0"
         itemClick="{dispatchEvent(event)}"
         horizontalScrollPolicy="off"
         verticalScrollPolicy="on"
         tabWidth="60"
         tabHeight="57"
         verticalGap="5"
         top="5"
         labelField="{null}"
         iconField="icon"
         buttonMode="true"
         styleName="leftTabItemSkin"
         rollOver="tb_creationComplete(event);"
         rollOut="destroyTip(event);"
         creationComplete="{this.selectedIndex =
_selectedIndex};tb_customTooltip(event)"
         />

Reply via email to