Idealism is what precedes experience; cynicism is what follows...

Friday, June 20, 2008

Adobe Flex : There is a bug in the Adobe Flex Framework ToolTipManager Implementation

I have registered it with the Adobe Flex Team.
https://bugs.adobe.com/jira/browse/SDK-15863


When using a CustomToolTip set via the ToolTipmanager.toolTipClass property, "text" is never invoked.
Its easily solved however, it just requires you to override commitProperties and set the text yourself.

  override protected function commitProperties():void
{
super.commitProperties();
text = ToolTipManager.currentTarget[ "toolTip" ];
}


And here is a complete implementation of a custom tooltip.

package
{
import mx.containers.Canvas;
import mx.controls.Button;
import mx.core.IToolTip;
import mx.managers.ToolTipManager;

public class CustomToolTip extends Canvas implements IToolTip
{
private var _button:Button;

public function CustomToolTip()
{
super();
}

override protected function createChildren():void
{
super.createChildren();
_button = new Button();
addChild( _button );
}

override protected function commitProperties():void
{
super.commitProperties();
text = ToolTipManager.currentTarget[ "toolTip" ];
}

public function get text() : String
{
return _button.label;
}
public function set text( value:String ) : void
{
_button.label = value;
}
}
}


I suppose you can also workaround it by changing the ToolTipManagerImpl class, but I prefer not to change the framework sourcecode for so many reasons that its beyond the scope of this post.

Also, I really dislike every sample out there illustrating how to implement custom tooltips, as they all involve calling a method on a toolTip event and hence requires you to use your custom ToolTip logic everywhere in your system instead of using the framework.

1 comments:

Dave said...

This bug is frustrating because it is a single-character error in ToolTipManagerImpl.as:

809: mx_internal function initializeTip():void
810: {
811: // Set the text of the tooltip.
812: if (currentToolTip is ToolTip)
813: ToolTip(currentToolTip).text = currentText;

line 812 should read:

if (currentToolTip is IToolTip)

And this would not be a problem. :-P

Dave

Blog Archive

My Network

  • Optimizing Png’s - A good friend and colleague of mine, Paw Suddergaard, pointed me towards PngGauntlet for optimizing png’s. I just gave it a shot and saved the users for ar...
    1 day ago
  • FlexPMD on eclipse - My Colleague and friend Niels Bjerg, has a post about FlexPMD released as an Eclipse plugin. Read about it here.
    4 days ago
  • Twitter Q & A - moritzde @ML Morten, you asked for questions: why isn’t there a secondary market for medicin & medical tools, e.g. splints? let’s create one! r u in? about...
    5 days ago
  • Links for Motorcycle enthusiasts - MC travel-blogs: Must see: http://www.kccd.no/ http://4qconditioning.blogspot.com/ Danish blogs: http://www.ossianbuilds.blogspot.com http://wrenchmonkees....
    1 week ago
  • Changing online banking - Photo courtesy of Daniel Y. Go Before I moved to Denmark I used HSBC for fifteen years. Their online banking system was adequate initially, and has grown...
    2 weeks ago
  • Google Wave Notifications - You might be one of the lucky few that have been granted a Google Wave account. It's a really cool tool, but my problem has been that I kind of forget to c...
    4 weeks ago
  • St Martin - So, in Holland we celebrate Sint Maarten by kids going around town with lanterns, singing songs at doors, collecting candy (I wonder if this is actually re...
    5 weeks ago
  • New AIR Video Tutorials - I’ve just added a couple of new AIR tutorials to my video tutorials page: 1. Reading In A Text File (and displaying the icon) 2. Recursively searching a us...
    2 months ago
  • How to work with User Experience methods - I have now been working in the field of User Experience for approximately 10 years, and the holy grail has always been some kind of coherent methodology wh...
    2 months ago
  • Ambient Intelligence - Kort fortalt om Ubiquitous computing, EeryWare, Intelligent Abience. Eller det at være omgivet af en cloud af viden og computerkraft, der hjælper os mere o...
    3 months ago
  • - *There are certain laws that have been regarded as sacrosanct in the advertising business, and particularly within the creative side of the ad world. They ...
    3 months ago
  • Papervision TODO - Papervision 2.0 is cool but surprisingly oldschool/low-level, when you are used to Flex and/or modeling tools like Blender/3dMax,SchetchUp. A small selecti...
    5 months ago
  • New Arduino project - I found myself a new Arduino project - an automated car! Well how to go about this. My best approach was to get a cheap RC toy car from the local toy store...
    5 months ago
  • Unrecognized selector sent to instance - As you may or may not know, I do iPhone/Cocoa touch now... While playing around with something this evening I stumbled across something I thought I'd share...
    9 months ago

About Me

Peter Andreas Molgaard
Copenhagen, Denmark
View my complete profile