# Mouse Trail, AS2 -\> AS3

**URL:** <https://forum.kirupa.com/t/mouse-trail-as2-as3/281197>\
**Category:** flash\
**Created:** [February 5, 2009, 11:14pm UTC](https://forum.kirupa.com/t/mouse-trail-as2-as3/281197 "2009-02-05T23:14:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skot00mc](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@skot00mc](https://forum.kirupa.com/u/skot00mc)\
**Post date:** [February 5, 2009, 11:14pm UTC](https://forum.kirupa.com/t/mouse-trail-as2-as3/281197/1 "2009-02-05T23:14:12Z")

</div>

I read a [[COLOR=RoyalBlue]post[/COLOR] about this [COLOR=RoyalBlue][U][URL=“http://www.kirupa.com/developer/mx/mousetrailer.htm”]effect](http://www.kirupa.com/forum/showthread.php?p=2435020&posted=1#post2435020)[/U][/COLOR], which was done in MX. I’m trying to port this code to AS3 and am having trouble.

I can’t get the letters to trail, just the whole word. The issue is in the last part.

```auto
var Text = "Text trails";
var letters = Text.split("");
var letterformat = new TextFormat();
    letterformat.font = "Verdana";
    letterformat.align = "center";
    letterformat.size = "10";
    letterformat.color= 0x000000;
var LTR:Number;
var spacing = 8;
var speed = 3;
var mc:MovieClip;
var tf:TextField;
for (LTR = 0; LTR<letters.length; LTR++) {
    mc = new MovieClip();
    mc.name = "mc"+LTR+"1";
    tf = new TextField();
    tf.name = "_"+letters[LTR];
    with (tf) {
        text = letters[LTR];
        x = LTR * spacing;
        y = 10;
        setTextFormat(letterformat);
        selectable = false;
    }
    addChild(mc);
    mc.addChild(tf);
}

if (LTR) {
    //Not sure what to do with this
    //mc.prevClip = _root[(LTR-1)+"l"];
    mc.addEventListener(Event.ENTER_FRAME, trailLTR);
} else {
    mc.addEventListener(Event.ENTER_FRAME, trail);
}
function trailLTR(e:Event):void {
    //Not sure what to do with this
    //this._x += (this.prevClip._x-this._x+5)/speed;
    this.x += (mc.mouseX - this.x + 5)/speed;
    this.y += (mc.mouseY - this.y)/speed;
}
function trail(e:Event):void {
    this.x += (this.parent.mouseX - this.x + 10)/speed;
    this.y += (this.parent.mouseY - this.y + 10)/speed;
}

```
