Tool Tip Disapear when no Text is inside

Tool tip must dispear if nothing is happening

Page 1 of 1

5 Replies - 1064 Views - Last Post: 26 August 2008 - 08:40 AM

#1 bmcc81   User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 320
  • Joined: 10-July 07

Tool Tip Disapear when no Text is inside

Post icon  Posted 21 August 2008 - 08:51 AM

Hi,

I've got this tool tip that when I mouse over it comes up, but sometimes when I move fast the tool tip pops up but no text fills itself in and it stays empty on the stage.

This sucks!!!

I need it to disapeare when there is nothing inside it. Can anyone help with some idea's on doing this?

This is my code:

tipText.autoSize = true;
tipText.autoSize = "center";
tipText.multiline = "false";

this._alpha = 0;

this.swapDepths(_root.getNextHighestDepth());

_global.MovieClip.prototype.expand = function(toolText) {
	tipText.text = toolText;
	mask.tween("_width", Math.floor(tipText._width + 25), 0, "easeInQuad");
	fd.tween("_width", Math.floor(tipText._width + 5), 0, "easeInQuad");
	ld_d.tween("_x", Math.floor(tipText._width/2 + 3), 0, "easeInQuad");
	ld_e.tween("_x", Math.floor(-tipText._width/2), 0, "easeInQuad");
	_x = this._x + this._width/2;
	_y = this._y +50;
	_alpha = 0;
	alphaTo(100, 0, "easeInQuad");
	tween("_y", Stage.height/2 + 60, 0, "easeInQuad");
	_root.getNextHighestDepth();
};

_global.MovieClip.prototype.disappear = function() {
	tipText.text = "";
	mask.tween("_width", 20, 0, "easeInQuad");
	fd.tween("_width", 20, 0, "easeInQuad");
	ld_d.tween("_x", 10, 0, "easeInQuad");
	ld_e.tween("_x", -8, 0, "easeInQuad");
	alphaTo(0, 0, "easeInQuad");
	tween("_y", 360, 0, "easeInQuad");
};



Thanks,

Is This A Good Question/Topic? 0
  • +

Replies To: Tool Tip Disapear when no Text is inside

#2 BetaWar   User is offline

  • #include "soul.h"
  • member icon

Reputation: 1651
  • View blog
  • Posts: 8,523
  • Joined: 07-September 06

Re: Tool Tip Disapear when no Text is inside

Posted 21 August 2008 - 03:01 PM

why not just add a check in the end of the function that says something like this:

if(tipText.text == ''){
  // The text hasn't been set yet
}


Then have it do whatever (maybe have it set the text again, or have a loop to make sure that it is set.

HTH
Was This Post Helpful? 0
  • +
  • -

#3 bmcc81   User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 320
  • Joined: 10-July 07

Re: Tool Tip Disapear when no Text is inside

Posted 22 August 2008 - 07:35 AM

Hey BetaWar,

I read your post and came up with this.

function moveTip()
{
	tooltip._x = _root._xmouse; 				
	tooltip._y =  385;
	if (_root.tooltip.tipText.text == '') {
		_root.tooltip._alpha = 0;
}
}



I still get that the tooltip with nothing in it. Any suggestions?
Thanks,
Was This Post Helpful? 0
  • +
  • -

#4 JBrace1990   User is offline

  • D.I.C Addict
  • member icon

Reputation: 112
  • View blog
  • Posts: 760
  • Joined: 09-March 08

Re: Tool Tip Disapear when no Text is inside

Posted 22 August 2008 - 04:06 PM

well, i'm not sure... alpha should work... but you should also add an else statement to reset the alpha...
Was This Post Helpful? 0
  • +
  • -

#5 bmcc81   User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 320
  • Joined: 10-July 07

Re: Tool Tip Disapear when no Text is inside

Posted 25 August 2008 - 07:38 AM

View PostJBrace1990, on 22 Aug, 2008 - 04:06 PM, said:

well, i'm not sure... alpha should work... but you should also add an else statement to reset the alpha...



Good Idea, Thanks
Was This Post Helpful? 0
  • +
  • -

#6 bmcc81   User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 320
  • Joined: 10-July 07

Re: Tool Tip Disapear when no Text is inside

Posted 26 August 2008 - 08:40 AM

Well I ended up using _visible

I find it works better. So her is my complete little code bit.

//------------ Moving the tooltip
function moveTip()
{
	tooltip._x = _root._xmouse; 								//		this._parent._x;
	tooltip._y =  385;
	
	if (_root.tooltip.tipText.text == '') {
		_root.tooltip._visible = 0;
	}else{
		_root.tooltip._visible = 100;
	}
}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1