public class ToolTip3DManager
{
public function ToolTip3DManager()
{
}

private static var _timer:Timer = null;
private static var _ToolTipEnavelTime:int = 1000;
private static var _ToolTipShowingInterVal:int = 5000;
private static var _toolTip:IToolTip = null;
private static var _text:String = “”;

public static function get Text():String
{
return _text;
}

public static function set Text(value:String):void
{
_text = value;
}

private static var _x:Number = 0;

public static function get X():Number
{
return _x;
}

public static function set X(value:Number):void
{
_x = value;
}

private static var _y:Number = 0;

public static function get Y():Number
{
return _y;
}

public static function set Y(value:Number):void
{
_y = value + 20;
}

public static function Show():void
{
if(_toolTip!=null)
{
ToolTipManager.destroyToolTip(_toolTip);
_toolTip = null;
}

if(_timer != null && _timer.running)
_timer.stop();

_timer = new Timer(_ToolTipEnavelTime);
_timer.addEventListener(TimerEvent.TIMER,updateTimer);
_timer.start();
}

public static function Hide():void
{
if(_toolTip!=null)
ToolTipManager.destroyToolTip(_toolTip);
if(_timer != null && _timer.running)
_timer.stop();
_toolTip = null;
}

private static function updateTimer(evt:TimerEvent):void {
if(_timer != null && _timer.running)
_timer.stop();

if(_toolTip == null)
{
_toolTip = ToolTipManager.createToolTip(Text,X,Y);
_timer = new Timer(_ToolTipShowingInterVal);
_timer.addEventListener(TimerEvent.TIMER,updateTimer);
_timer.start();
}
else
Hide();
}

}

MouseOver ->

ToolTip3DManager.Text = “Sample”;

var posi:Number2D = ObjectContainer2DPosition(this);

ToolTip3DManager.X = posi.x;

ToolTip3DManager.Y = posi.y;

ToolTip3DManager.Show();
MouseOut ->

ToolTip3DManager.Hide();
without mouseover if you want to show auto tooltip then we have to done all the mouse move activities with mouse move.

Advertisements