PDA

View Full Version : Tooltips in Movieclip


caffeinerush
07-23-2006, 03:54 AM
Hi, I followed the gotoAndLearn tooltip tutorial just a little while ago. Reason I'm posting the ques here is gotoandLearn.com is down right now.

The problem is when the code and tooltip are placed inside a movieclip, it does not display at all. It works just fine on the root timeline.

I changed the code from:

tooltip._visible = false;

var tipInt;

b1.onRollOver = function() {
tipInt = setInterval(showTip,100,"Previous Animation");
}

b1.onRollOut = function() {
hideTip();
}

b2.onRollOver = function() {
tipInt = setInterval(showTip,100,"Next Animation");
}

b2.onRollOut = function() {
hideTip();
}

var count = 0;

function showTip(tiptext) {
if(count == 3) {
clearInterval(tipInt);
count = 0;
tooltip.tiptext.text = tiptext;
tooltip._x = _root._xmouse;
tooltip._y = _root._ymouse;
tooltip._visible = true;
_root.onMouseMove = function() {
tooltip._x = _root._xmouse;
tooltip._y = _root._ymouse;
updateAfterEvent();
}
}

else {
count++;
}
}

function hideTip() {
clearInterval(tipInt);
tooltip._visible = false;
delete _root.onMouseMove;
}


To:

tooltip._visible = false;

var tipInt;

b1.onRollOver = function() {
tipInt = setInterval(showTip,100,"Previous Animation");
}

b1.onRollOut = function() {
hideTip();
}

b2.onRollOver = function() {
tipInt = setInterval(showTip,100,"Next Animation");
}

b2.onRollOut = function() {
hideTip();
}

var count = 0;

function showTip(tiptext) {
if(count == 3) {
clearInterval(tipInt);
count = 0;
tooltip.tiptext.text = tiptext;
tooltip._x = this._parent._xmouse;
tooltip._y = this._parent.[/b]_ymouse;
tooltip._visible = true;
this.onMouseMove = function() {
tooltip._x = this._parent._xmouse;
tooltip._y = this._parent._ymouse;
updateAfterEvent();
}
}

else {
count++;
}
}

function hideTip() {
clearInterval(tipInt);
tooltip._visible = false;
delete _root.onMouseMove;
}

When I changed the target paths (like _root) the tooltip actually showed up, but didn't seem to read where the mouse was going. Like this:

http://www.caffeinerush.net/caffeinerush/A%20image/flashsitescreenshot.jpg


Thanks in advance...

caffeinerush
07-25-2006, 12:14 AM
*bump*

Please, does anyone know how I should change the target paths? Almost done my site so I don't want to stop now. Thanks.

mapvnfx
07-25-2006, 04:13 AM
you don't put the tooltip at the main timeline so you should consider about its coordinate inside the parent mc

maybe change:
tooltip._x = this._parent._xmouse;

to:

tooltip._x = this._parent._xmouse - this._x;

and do the same with some other lines in your code :)

note: i haven't tested it yet :D :D

caffeinerush
07-25-2006, 08:49 PM
Thanks for the reply, doesnt seem to change it though. Maybe it helps if I say the tooltip code is on a blank keyframe and the tooltip movieclip is referenced from there.

Cheers.

mapvnfx
07-26-2006, 04:51 AM
is the tooltip inside any mc? can u upload your source code here? it'll be easier

caffeinerush
07-27-2006, 05:52 PM
Ok, here's the .fla

http://www.caffeinerush.net/caffeinerush/A%20image/sitev2.fla

And yes, its in the animationscontent movieclip.

mapvnfx
07-28-2006, 04:16 AM
:D i think the pointer this inside the showTip function doesn't refer to the animationscontent movieclip -> that function doesn't work as expected

you can use the absolute path: _root.animationscontent._xmouse
function showTip(tiptext) {
if(count == 3) {
clearInterval(tipInt);
count = 0;
tooltip.tiptext.text = tiptext;
tooltip._x = _root.animationscontent._xmouse;
tooltip._y = _root.animationscontent._ymouse;
tooltip._visible = true;
_root.animationscontent.onMouseMove = function() {
tooltip._x = _root.animationscontent._xmouse;
tooltip._y = _root.animationscontent._ymouse;
updateAfterEvent();
}
}

else {
count++;
}
}


or you can use the variable: var thisMC=this; and than use thisMC instead of this

tooltip._visible = false;
var thisMC = this;
.........
function showTip(tiptext) {
if(count == 3) {
clearInterval(tipInt);
count = 0;
tooltip.tiptext.text = tiptext;
tooltip._x = thisMC._xmouse;
tooltip._y = thisMC._ymouse;
tooltip._visible = true;
thisMC.onMouseMove = function() {
tooltip._x = thisMC._xmouse;
tooltip._y = thisMC._ymouse;
updateAfterEvent();
}
}

else {
count++;
}
}

i tested and it works!

good luck :D

caffeinerush
07-29-2006, 08:16 PM
Thanks so much for your help. Good to see people like you around.