Code:
var dotList = new Array('Viale Abruzzi', 'Viale Dei Mille', 'Viale Umbria','Viale Romagna','Viale Campania','Viale Molise','Corso 22 Marzo','Viale Corsica','Viale Emilio Caldara','Viale Bianca Maria','Via Gaio');
// adjust this number to change how far you have to be from the clip to turn on the toolTip
var checkDistance = 80;
//
for (var i = 0; i < _root.dotList.length; i++) {
var mc = _root['str' + i];
mc.dragToolTip = false;
mc.createEmptyMovieClip('toolTip', 0);
mc.toolTip._rotation = -mc._rotation;
mc.toolTip._alpha = 0;
_root['str' + i].toolTip.createTextField("ct", 0, 0, 0, 30, 30);
with (_root['str' + i].toolTip.ct) {
_x = -2;
_y = 12;
antiAliasType = "advanced";
gridFitType = "subpixel";
autoSize = true;
embedFonts = true;
selectable = false;
text = _root.dotList[i];
var f = new TextFormat();
f.color = 0x000000;
f.font = "myFont";
f.size = 12;
setTextFormat(f);
}
mc.onRollOver = function() {
this.dragToolTip = true;
};
mc.onRollOut = function() {
this.dragToolTip = false;
};
mc.onEnterFrame = function() {
if (this.dragToolTip) {
var mc = this.toolTip;
mc._x = this._xmouse;
mc._y = this._ymouse;
}
};
}
//
_root.onMouseMove = function() {
if (_level100 != undefined) {
return;
}
for (var i = 0; i < _root.dotList.length; i++) {
var mc = _root['str' + i];
var dist = getDistance(mc._x, mc._y, _root._xmouse, _root._ymouse);
if (dist < checkDistance) {
mc.toolTip._alpha = 100 * ((checkDistance - dist) / checkDistance);
} else {
mc.toolTip._alpha = 0;
}
}
updateAfterEvent();
};
this is just an isolate example of the script that works on the timeline but it doesn't when placed inside of a MC
Bookmarks