Thanks Johan! That's the power of pair-programming :-).
Cheers,
/Johan
On 03/03/2008, Johan Lopes <[EMAIL PROTECTED]> wrote:
>
> Hi Daniel,
>
> The children are only buttons, autocreated by the TabBar when you pass
> it data (ArrayCollection or Arrays) as its DataProvider. My
> DataProvider has labels and icon values that gets passed to the
> buttons.
> The custom tooltip I wanted to use looks the same as the errorTooltip
> you get when you get an errror in Flex, so I overrode the default one,
> re-skinned it, and made it look on-brand (it's normally red as you
> know). I wanted to "tap into" the arrows from errorRight, errorBelow
> etc from the Flex errorTip and use that as my custom tooltip.
>
> Here's the code that does it all, if anyone runs into similar issues
> and want to call a custom tooltip using the TooltipManager, calling
> custom tooltips that is not a Panel etc.
>
> .errorTip {
> font-family: MyFont;
> font-weight: normal;
> font-size: 12px;
> color: #000000;
> padding-left: 0;
> padding-bottom: 4;
> background-alpha: 1;
> corner-radius: 0;
> drop-shadow-enabled: "false";
> border-color:#FFFFFF;
>
> }
>
> I ended up doing this:
>
> CustomTooltip code:
> ___________________
>
> [Bindable]
> public var myTip:ToolTip;
>
> public var tab:Tab;
>
> private function tb_creationComplete(event:Event):void
> {
> this.selectedIndex = _selectedIndex;
> for (var i:uint = 0; i < tb.dataProvider.length; i++)
> {
> tab = Tab(tb.getChildAt( i ));
> tab.addEventListener(MouseEvent.ROLL_OVER, createTip);
> tab.addEventListener(MouseEvent.ROLL_OUT,
> destroyTip);
> }
> }
>
> private function createTip(event:MouseEvent):void
> {
> tab = Tab(event.target);
> var tabLabel:String = sectionCollectionArray.getItemAt(
> tb.getChildIndex(DisplayObject(event.target)) ).label;
> myTip = ToolTipManager.createToolTip(tabLabel,tab.x+75,
> tab.y+19,"toolTipRight") as ToolTip;
> myTip.setStyle("styleName", "errorTip");
> myTip.percentWidth = 100;
> myTip.percentHeight = 100;
> }
>
> private function destroyTip( event:Object ):void
> {
> ToolTipManager.destroyToolTip(myTip);
> }
>
> TabBar code:
> __________________
>
> <mx:TabBar id="tb" dataProvider="{sectionCollectionArray}"
> 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"
> creationComplete="tb_creationComplete(event);"
> />
>
> On Mon, Mar 3, 2008 at 7:59 PM, Daniel Gold <[EMAIL
> PROTECTED]<danielggold%40yahoo.com>>
> wrote:
> >
> >
> >
> >
> >
> >
> > What kind of children are you adding to the TabBar? I have a tabbed
> > based app where the children all extend Panel and are located in
> > separate MXML files. I simply set the toolTip="Custom tooltip text" in
> > the attribute of the root MXML tab and each child shows its own
> > tooltip when hovered. Is that what you're looking for? Even if you're
> > creating and adding the children in AS you should be able to set the
> > toolTip for each one to the string you want. The components will
> > handle displaying their tooltips on their own.
> >
> >
>
>