Skip to main content
Inspiring
September 18, 2008
Question

Tooltips in as3

  • September 18, 2008
  • 7 replies
  • 1942 views
I am looking to code a tooltip for a UILoader. The text for the tooltip will come from a parsed RSS feed.
I see several examples of how to do this in AS2, but it seems that it was left out of AS3.
Is there a component that will achieve this?
There is nothing in the AS3 Flash help about tooltips in AS3.
Help!
Stumped.
This topic has been closed for replies.

7 replies

GumpsterFAuthor
Inspiring
September 30, 2008
Thanks to the community and especially to dzedward for all your help in answering this question. Gumpster.
Damon Edwards
Inspiring
September 26, 2008
click my user name
GumpsterFAuthor
Inspiring
September 29, 2008
I have emailed you a new very clean Fla.
Damon Edwards
Inspiring
September 26, 2008
yea, email me the file.
GumpsterFAuthor
Inspiring
September 26, 2008
OK, what would be your email address dzedward?
Damon Edwards
Inspiring
September 25, 2008
Sorry for not returning to this earlier, will you please zip up all files, including dependent files and post a link so I can download and see what is happening.
GumpsterFAuthor
Inspiring
September 25, 2008
I have nowhere to post the zipped fla for you to grab.
Can I email it to you?
I have re-done all that you suggested and I am no longer getting any errors, but I am not seeing any tooltip appear when I roll over my UILoader. The instance name of my UILoader in this case is aLoader. I have a movieclip in the library which is a empty dynamic text field which I named toolTip and exported it to actionscript using the linkage. This movieclip resides only in the library, correct?
Forrest
Damon Edwards
Inspiring
September 22, 2008
toolTip would be the class name of the movie clip in your library. right click it in the library, click 'linkage', and give it a class name of, toolTip.
GumpsterFAuthor
Inspiring
September 22, 2008
OK, I did as you said and I am getting this error on rollover now;
TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-188()
And I get this error on roll out;
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at MethodInfo-189()
Damon Edwards
Inspiring
September 19, 2008
forgot the text part :) In the 'over' function where you instantiate the new toolTip, set the text fields text property to whatever you want, ie:

function over(e:MouseEvent):void{
myToolTip = new toolTip();
myToolTip.x = mouseX;
myToolTip.y = mouseY;
myToolTip.myTxt.text = "Some Text";
addChild(myToolTip);
addEventListener(Event.ENTER_FRAME, moveTool);
};
GumpsterFAuthor
Inspiring
September 22, 2008
Thanks dzedward. That make sense, although I did not see the toolTip class anywhere in AS3.
It is not working for me. Do I need to import the class 1st? When I create a movieclip does it need to be a dynamic text field? If not, how do I set the text style and wrapping? Here is the error messages I am getting;
1046: Type was not found or was not a compile-time constant: toolTip.
Damon Edwards
Inspiring
September 19, 2008
its pretty simple. create a movie clip and set it to export, then instatiate the movie clip when whatever actions occurs, listen for the enterFrame event to move the tool tip with the mouse.. something like this:

var myToolTip:toolTip; // toolTip would be the class name

uiLoader.addEventListener(MouseEvent.MOUSE_OVER, over);
uiLoader.addEventListener(MouseEvent.MOUSE_OUT, out);

function over(e:MouseEvent):void{
myToolTip = new toolTip();
myToolTip.x = mouseX;
myToolTip.y = mouseY;
addChild(myToolTip);
addEventListener(Event.ENTER_FRAME, moveTool);
};
function out(e:MouseEvent):void{
removeEventListener(Event.ENTER_FRAME, moveTool);
removeChild(myToolTip);
};
function moveTool(e:Event):void{
myToolTip.x = mouseX;
myToolTip.y = mouseY;
};