_global.schrift = function () {
var list = TextField.getFontList()
for (var element in list) {
if (list[element].toLowerCase() == "arial") return list[element]
else if (list[element].toLowerCase() == "helvetica") return list[element]
else if (list[element].toLowerCase() == "sans-serif") return list[element]
}
return list[0]
}
MovieClip.prototype.netTrek_square = function(r_width, r_height, fillColor, fillAlpha, linethickness, lineColor, lineAlpha, h_align, v_align) {
var w, h, c, a, t, lc, la, ha, va, l, x0, x1, x2, x3, y0, y1, y2, y3, ltca;
l = arguments.length;
ltca = true; w = r_width; h = r_height;
c = fillColor; a = fillAlpha;
if (l<9) {
if (typeof (arguments[4]) == "string" && typeof (arguments[5]) == "string") {
ltca = false; ha = arguments[4]; va = arguments[5];
} else {
t = linethickness; lc = lineColor; la = lineAlpha;
ha = h_align; va = v_align;
}
} else {
t = linethickness; lc = lineColor; la = lineAlpha;
ha = h_align; va = v_align;
}
ha = String(ha).toLowerCase().substr(0, 1);
va = String(va).toLowerCase().substr(0, 1);
if (ha == "l") { x0 = x3=0; x1 = x2=w; }
else if (ha == "r") { x0 = x3=-w; x1 = x2=0; }
else { x0 = x3=-w/2; x1 = x2=w/2; }
if (va == "t") { y2 = y3=0; y0 = y1=h; }
else if (va == "b") { y2 = y3=-h; y0 = y1=0; }
else { y2 = y3=-h/2; y0 = y1=h/2; }
var offSet = new Object()
offSet.x = x3
offSet.y = y3
with (this) {
clear();
if (ltca) lineStyle(t, lc, la);
beginFill(c, a); moveTo(x0, y0);
lineTo(x1, y1); lineTo(x2, y2); lineTo(x3, y3);
lineTo(x0, y0); endFill();
}
return offSet
};
//------------------------------------
MovieClip.prototype.netTrek_TTText = function(t, e, c, a, b, f, i, s, u) {
this.createTextField("ntttt", 1, 0, 0, 9, 9);
this.ntttt.autoSize = "left"; this.ntttt.multiline = true; this.ntttt.selectable = false;
this.ntttt.embedFonts = e; this.ntttt.text = t;
this.ntttt.textColor = c;
var ntttf = new TextFormat();
ntttf.align = a; ntttf.bold = b;
ntttf.color = ntttt.textColor;
ntttf.font = f; ntttf.italic = i;
ntttf.size = s; ntttf.underline = u;
this.ntttt.setTextFormat(ntttf);
};
//-------------------------------------------
Button.prototype.netTrek_toolTipp = MovieClip.prototype.netTrek_toolTipp = function (toolTippText, ttextEmbedFonts, ttextColor, ttextAlign, ttextBold, ttextFont, ttextItalic,
ttextSize, ttextUnderline, ttfillColor, ttfillAlpha, ttlinethickness, ttlineColor, ttlineAlpha,showHand,distance,vertical_fit,horizontal_fit, delay){
memory1 = this.onRollOver
memory2 = this.onRollOut
memory3 = this.onDragOut
memory4 = this.onReleaseOutside
if (typeof(this)=="movieclip"){
bound = this.getBounds(_root)
var nt_button = false
var nt_left = bound.xMin;
var nt_midd = bound.xMin+this._width/2
var nt_right = bound.xMax
var nt_top = bound.yMin
var nt_cent = bound.yMin+this._height/2
var nt_butt = bound.yMax
} else var nt_button = true
this.useHandCursor = showHand
this.onRollOver = function () {
memory1 ()
tDelay = setInterval (function () {
createEmptyMovieClip("controller_n" ,9999)
controller_n.makeIT = function () {
_root.nt_tooltip.removeMovieClip();
if(vertical_fit=="auto"){
if(!nt_button) {
if (_root._xmouse >= nt_left && _root._xmouse < nt_midd) ha="r"
if (_root._xmouse >= nt_midd && _root._xmouse <= nt_right) ha="l"
}else ha="r"
}else ha = vertical_fit.toLowerCase().substring(0,1)
if(horizontal_fit=="auto") {
if(!nt_button) {
if (_root._ymouse >= nt_top && _root._ymouse < nt_cent) va="b"
if (_root._ymouse >= nt_cent && _root._ymouse <= nt_butt) va="t"
}else va="b"
}else va = horizontal_fit.toLowerCase().substring(0,1)
_root.createEmptyMovieClip("nt_tooltip",1000)
with (_root.nt_tooltip) {
_visible = false;
_root.nt_tooltip.netTrek_TTText (toolTippText, ttextEmbedFonts, ttextColor, ttextAlign, ttextBold, ttextFont, ttextItalic, ttextSize,
ttextUnderline)
_root.nt_tooltip.pos = _root.nt_tooltip.netTrek_square (ntttt._width,ntttt._height,ttfillColor, ttfillAlpha, ttlinethickness,
ttlineColor, ttlineAlpha,ha,va)
ntttt._x = _root.nt_tooltip.pos.x;
ntttt._y = _root.nt_tooltip.pos.y;
delete pos; _visible = true;
_x = (ha=="l") ? (_xmouse+distance) : (_xmouse-distance)
_y = (va=="b") ? (_ymouse-distance) : (_ymouse+distance)
}
}
controller_n.makeIT ()
controller_n.onMouseMove = controller_n.makeIT
controller_n.onUnload = function () {
_root.nt_tooltip.removeMovieClip();
controller_n.removeMovieClip()
}
clearInterval(tDelay);
delete tDelay
},delay*1000)
}
this.onRollOut = function () {
memory2 ()
clearInterval(tDelay)
delete tDelay
_root.nt_tooltip.removeMovieClip();
controller_n.removeMovieClip()
}
this.onReleaseOutside = function () {
memory4 ()
clearInterval(tDelay)
delete tDelay
_root.nt_tooltip.removeMovieClip();
controller_n.removeMovieClip()
}
this.onDragOut = function () {
memory3 ()
clearInterval(tDelay)
delete tDelay
_root.nt_tooltip.removeMovieClip();
controller_n.removeMovieClip()
}
}
Button.prototype.netTrekTTTextOption = MovieClip.prototype.netTrekTTTextOption = function(obj) {
if (this.toolTipOption == undefined) this.toolTipOption = new Object()
this.toolTipOption["tippText"] = "default"
this.toolTipOption["embedFont"] = false
this.toolTipOption["textColor"] = parseInt("0x333333")
this.toolTipOption["textAlign"] = "left"
this.toolTipOption["bold"] = false
this.toolTipOption["font"] = schrift()
this.toolTipOption["italic"] = false
this.toolTipOption["textSize"] = 10
this.toolTipOption["underline"] = false
this.toolTipOption["fillColor"] = parseInt("0xFFFF99")
this.toolTipOption["fillColorAlpha"] = 100
this.toolTipOption["lineThickness"] = 1
this.toolTipOption["lineColor"] = parseInt("0x000000")
this.toolTipOption["lineColorAlpha"] = 100
this.toolTipOption["showHand"] = this.useHandCursor
this.toolTipOption["distance"] = 2
this.toolTipOption["vertical_fit"] = "right"
this.toolTipOption["horizontal_fit"] = "bottom"
this.toolTipOption["delay"] = 0.1
for (var elemet in obj) { this.toolTipOption[elemet] = obj[elemet]}
//for (q in this.toolTipOption) { trace(q +" - "+this.toolTipOption[q])}
}
Button.prototype.setToolTippText = MovieClip.prototype.setToolTippText = function (value) {
this.toolTipOption["tippText"] = value
}
Button.prototype.toolTipp = MovieClip.prototype.toolTipp = function (value) {
if (arguments.length > 1) this.netTrekTTTextOption (arguments[1])
else if (this.toolTipOption == undefined) this.netTrekTTTextOption ()
this.setToolTippText (value)
this.netTrek_toolTipp ( this.toolTipOption["tippText"],
this.toolTipOption["embedFont"],
this.toolTipOption["textColor"],
this.toolTipOption["textAlign"],
this.toolTipOption["bold"],
this.toolTipOption["font"],
this.toolTipOption["italic"],
this.toolTipOption["textSize"],
this.toolTipOption["underline"],
this.toolTipOption["fillColor"],
this.toolTipOption["fillColorAlpha"],
this.toolTipOption["lineThickness"],
this.toolTipOption["lineColor"],
this.toolTipOption["lineColorAlpha"],
this.toolTipOption["showHand"],
this.toolTipOption["distance"],
this.toolTipOption["vertical_fit"],
this.toolTipOption["horizontal_fit"],
this.toolTipOption["delay"])
}
/*
Examples how to use
//just use the toolTipp Methode
my_bt.toolTipp("HALLO Button")
my_mc.toolTipp("Hallo MovieClip")
//use the toolTipp Methode and set some Options with an Oject
my_bt.toolTipp("HALLO Button",{underline:true, delay:1, showHand:false})
my_mc.toolTipp("Hallo MovieClip",{bold:true, italic:true, textColor:parseInt('0xFF0000')})
// this settings ar posible:
tippText := String
embedFont := boolean
textColor := parseInt("0x333333") //set - hex color with parseInt
textAlign := "left" // or "center" - "middle"
bold := boolean
font := fontname or schrift() function (this set an default font that was found on the client)
italic := boolean
textSize := Number
underline := boolean
fillColor := see textColor
fillColorAlpha := percent (0-100)
lineThickness := Number (1-99)
lineColor := see textColor
lineColorAlpha := percent (0-100)
showHand := boolean
distance := Number (distance between ToolTip and Mouse)
vertical_fit := "right","auto" or "left"
horizontal_fit := "bottom", "auto" or "top"
delay := second (number)
my_bt.netTrekTTTextOption ({ delay:0,
font:schrift(),
lineColorAlpha:0,
fillColorAlpha:0,
textColor:parseInt('0xCCCCCCC')
})
my_bt.toolTipp("foo")
my_mc.netTrekTTTextOption ({ delay:0,
font:schrift(),
lineColorAlpha:0,
fillColorAlpha:0,
textColor:parseInt('0xCCCCCCC'),
showHand:false
})
my_mc.toolTipp("foo")
*/
_global.buttonObj = new Object()
buttonObj.delay = 0
buttonObj.font = schrift()
buttonObj.lineColorAlpha = 0
buttonObj.fillColorAlpha = 0
buttonObj.textColor = parseInt('0xFFCCCCC')
_global.movieclipObj = new Object()
movieclipObj.delay = 0
movieclipObj.font = schrift()
movieclipObj.lineColorAlpha = 0
movieclipObj.fillColorAlpha = 50
movieclipObj.textColor = parseInt('0xCCCCCCC')
movieclipObj.showHand = false
movieclipObj.horizontal_fit = "auto"
movieclipObj.vertical_fit = "auto"
movieclipObj.distance = 10
my_bt.toolTipp("foo",buttonObj)
my_mc.toolTipp("foo",movieclipObj)