Mous Trail tutorial


I have a short comment on the mouse trail tutorial found on this site. It is a very nice effect (no wonder that many people use it), but I found that the string in the script can be changed only with limitations: you can’t use the same character twice in the string. The tutorial claimed that it can be changed ‘as needed’, but using only different characters can be quite annoying. The problem is caused by the fact that two or more movieclips have the same name if there are identical characters, and as a consequence the textfields will be created under the same movieclip. To fix the problem, use the following code:

Text = “aaaaaaa”;
letters = Text.split("");

letterformat = new TextFormat();
letterformat.font = “Verdana”;
letterformat.align = “center”;
letterformat.size = “10”;

spacing = 12;
speed = 5;
//–Creating the text–
for (L=0; L<letters.length; L++) {
_root.createEmptyMovieClip(letters[L]+L, L);
_root[letters[L]+L].createTextField(letters[L]+“t”, L, L*spacing, 10, 20, 20);
with (_root[letters[L]+L][letters[L]+“t”]) {
text = letters[L];
selectable = false;
//–Making it move–
if (L>0) {
_root[letters[L]+L].id = L;
_root[letters[L]+L].onEnterFrame = function() {
this._x += (_root[letters[]+(]._x-this.lastX)/speed;
this._y += (_root[letters[]+(]._y-this.lastY)/speed;
this.lastX = this._x;
this.lastY = this._y;
} else {
_root[letters[L]+L].onEnterFrame = function() {
this._x += (_root._xmouse-this.lastX+10)/speed;
this._y += (_root._ymouse-this.lastY)/speed;
this.lastX = this._x;
this.lastY = this._y;

The tutorial was really useful, just like the rest of the site. Thanks Kirupa!

I’ve tried to play with the kirupa mouse Trail Tutorial. i want to have it in just one part of the movie – so to remove it (code placed on button to move to other part of movie) I’ve tried removemovieClip, swapDepth +removemovieClip,
and even to place mousetrail within containerclip and then remove this.

Nothing, however seem to work … any tips.