I read a [COLOR=RoyalBlue]post[/COLOR] about this [COLOR=RoyalBlue][U][URL=“http://www.kirupa.com/developer/mx/mousetrailer.htm”]effect[/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.
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;
}