Your component will dispatch a toolTipCreate
event which you can catch and substitute in your own ToolTip instance.
From the docs: If you create
your own IToolTip object and place a reference to it in the toolTip
property of the event object that is passed to your toolTipCreate
handler, the ToolTipManager displays your custom tooltip. Otherwise, the
ToolTipManager creates an instance of ToolTipManager.toolTipClass to
display.
Matt
Found this post, but I imagine that this applies to Flex 1.5. I'd
like to create a custom toolTip in Flex 2.0 that would behave like a toolTip,
but would be able to take a dataObject as a parameter and would have some
formatting. I don't this this is possible w/ the toolTip styles
available in Flex 2.0 (beta 2), as these styles relate across the entire
toolTip. In any case, is there a new way to "hijack" the
toolTip class and substitute a custom one on a per-component basis?
On 7/6/05, Scott
Barnes <[EMAIL PROTECTED]>
wrote:
On 7/4/05, Laurent Bois
<[EMAIL PROTECTED]>
wrote:
> Hello,
> Initially, i thought tooltip was well adapted for this: it seems the
tooltip
> element can include only some text (with codes for carriage
return,
> tabulation, etc..), its behavior can be changed with CSS ( text
> font-color-size-family... , background, border styles).
>
> Perhaps is it possible to extends the tooltip component to do this: in my
> case i should define a tooltip 'layout' including header & body areas,
> accepting title and body text, and possibility to customize header and
body
> backgrounds.
Yes this is possible, basically what happens is that every component
inside FLEX that extends UIObject has a property called
"toolTipClass"
(string) which it uses in order to present a tool tip upon such
attribute being provided for that said component (pant)
eg:
<mx:Button label="blah" toolTip="blah"/>
Now, if you wanted to extend or customize the tooltip this can be done
in one of two ways:
1) You can hijack the actual toolTip class and swap it for your own via
<mx:Application>
<mx:Script>
import com.mossyblog.controls.ToolTip;
</mx:Script>
<!-- your typical app here -->
</mx:Application>
class com.mossyblog.controls.ToolTip extends mx.controls.ToolTip
{
static var symbolName:String = "mx.controls.ToolTip";
static var symbolOwner:Object = com.mossyblog.controls.ToolTip;
// Begin your logic here..
}
** NOTE: What's happening here is you are basically hijacking the
symbolName "mx.controls.ToolTip" and making such name point to your
custom built class, allowing you to effectively use the same tooltip
FLEX-APP-WIDE without having to touch existing code.
I've used the same approach for Tabs/TitleBackground and works well imho.
2) Extend the class in which you want to use yoru custom ToolTip only
with, and put the following:
class com.mossyblog.controls.Button extends mx.controls.Button {
var toolTipClass:String = "com.mossyblog.controls.ToolTip ";
}
** NOTE: Again, same concept except your telling the "Button" to use
a
custom ToolTip and not the default one (again making sure in your
"custom ToolTipClass" you set the static var symbolName:String =
"com.mossyblog.controls.ToolTip"
As for what you do with the toolTip? well anything you like. You could
put an mx:Panel inside your toolTip if you wanted to etc..but i'd
execute extreme caution with this, as this could be a dangerous point
in which performance may decrease as a result of a complex ToolTip.
> Another way i thought of was to show on "mouse over " a styled
Panel
> including already header (title) and the body part.
>
> What could be the best strategy to do this: tooltip or panel?
>
> Thanks for your help
>
> Laurent
>
>
> --
> Flexcoders Mailing List
> FAQ:
> http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
>
>
>
> ________________________________
> YAHOO! GROUPS LINKS
>
>
> Visit your group "flexcoders" on the web.
>
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
> ________________________________
>
--
Regards,
Scott Barnes
http://www.mossyblog.com
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS