Ich habe das ganze nun so gemacht, die Tooltips selbst:
Code:
tindrem.setToolTip("Stadt: Tindrem / City Guards vorhanden", 90, 0x0066CC, 100);
fabernum.setToolTip("Stadt: Fabernum / City Guards vorhanden", 90, 0x0066CC, 100);
meduli.setToolTip("Stadt: Meduli / City Guards vorhanden", 90, 0x0066CC, 100);
vadda.setToolTip("Stadt: Vadda / City Guards vorhanden", 90, 0x0066CC, 100);
bakti.setToolTip("Stadt: Bakti / City Guards vorhanden", 90, 0x0066CC, 100);
mohki.setToolTip("Stadt: Moh-Ki / City Guards vorhanden", 90, 0x0066CC, 100);
morinkhur.setToolTip("Stadt: Morin Khur / City Guards vorhanden", 90, 0x0066CC, 100);
toxai.setToolTip("Stadt: Toxai / City Guards vorhanden", 90, 0x0066CC, 100);
kranesh.setToolTip("Rote Stadt: Kranesh / City Guards nicht vorhanden", 90, 0xCC0000, 100);
cavecamp.setToolTip("Rotes Camp: Cavecamp / City Guards nicht vorhanden", 90, 0xCC0000, 100);
gaulkor.setToolTip("Rote Stadt: Gaul Kor / City Guards nicht vorhanden", 90, 0xCC0000, 100);
quest.setToolTip("Sunken Island, eine alte PVP Insel mit Keep Bauplatz",90,0x009900,100);
wolf1.setToolTip("Normale Wölfe",90,0x000000,100);
wolf2.setToolTip("Normale Wölfe",90,0x000000,100);
dualwolf1.setToolTip("Normale Wölfe, Dire Wolfes",90,0x000000,100);
dualwolf2.setToolTip("Normale Wölfe, Dire Wolfes",90,0x000000,100);
Und den Basecode:
Code:
MovieClip.prototype.setToolTip = function(msg:String, opac:Number, cl:Number, maxw:Number) {
var depth = this._parent.getNextHighestDepth();
if (this.DCToolTip) depth = this.DCToolTip.getDepth();
this.DCToolTip = this._parent.createEmptyMovieClip("dctooltip" + int(Math.random() * 10000), depth);
this.DCToolTip._x = this._xmouse + this._x;
this.DCToolTip._y = this._ymouse + this._y;
this.DCToolTip.owner = this;
with(this.DCToolTip) {
createTextField("tiptxt", 1, 1, 1, 10, 10);
tiptxt.autoSize = true;
if (maxw != undefined) {
tiptxt._width = maxw;
tiptxt.multiline = true;
tiptxt.wordWrap = true;
} else {
tiptxt.multiline = false;
tiptxt.wordWrap = false;
}
tiptxt.selectable = false;
//tiptxt.multiline = true;
tiptxt.embedFonts = true;
var tf:TextFormat = new TextFormat();
tf.font = "ToolTipFont";
tf.size = 11;
tiptxt.text = msg;
tiptxt.setTextFormat(tf);
var w = tiptxt.textWidth + 5;
var h = tiptxt.textHeight + 7;
lineStyle(1, 0, 100);
beginFill(cl, opac);
moveTo(0, 0);
lineTo(w, 0);
lineTo(w, h);
lineTo(0, h);
lineTo(0, 0);
_visible = false;
_alpha = 0;
adest = 0;
}
this.DCToolTip.onEnterFrame = function() {
var w = this.owner._width;
var h = this.owner._height;
if (this.owner._xmouse > 0 && this.owner._xmouse < w && this.owner._ymouse > 0 && this.owner._ymouse < h) {
this.adest = 100;
this._visible = true;
} else {
this.adest = 0;
}
this._alpha += (this.adest - this._alpha) / 3;
if (this.adest == 0 && this._alpha < 1) {
this._alpha = 0;
this._visible = false;
} else {
var dx = this.owner._x + this.owner._xmouse;
var dy = this.owner._y + this.owner._ymouse - this._height;
var x = this._x;
var y = this._y;
x += (dx - x) / 2;
y += (dy - y) / 2;
this._x = Math.round(x);
this._y = Math.round(y);
}
}
}
// ToolTip entfernen:
MovieClip.prototype.removeToolTip = function() {
if (this.DCToolTip) this.DCToolTip.removeMovieClip();
}
Wie kann ich es den bewerkstelligen das mir im Tooltip selbst noch ein Bild angezeigt wird neben dem Text? Oder wie kann ich den Text speziell noch formatieren?
Bzw. wenn ich es mit deinem Code mache Wanderratte wie müssen den die Bildpfade lauten wenn ich es extern einlade oder direkt von der Bibliothek?