Flash 8 dynamic drawing api

hi, i’m looking to recreate something like the line that follows the mouse on this page:

http://www.agualuca.com/agua.html

I assume that it uses the drawing api and the curveto command. however after much googling i cannot find any tutorials that resemble it.

can anyone help me?

cheers

thats a pretty sweet drawing effect

i had wondered what you thought of it!

var points:Array = new Array();
var prev_xmouse:Number;
var prev_ymouse:Number;
this.onEnterFrame = function():Void  {
 this.clear();
 this.lineStyle(1, 0x99CC00);
 var dx:Number = this._xmouse - prev_xmouse;
 var vx:Number = dx ? dx : Math.random() * randSet(-1, 1);
 var dy:Number = this._ymouse - prev_ymouse;
 var vy:Number = dy ? dy : Math.random() * randSet(-1, 1);
 var pLen:Number = points.push({x:this._xmouse, y:this._ymouse, vx:vx / 10, vy:vy / 10, life:getTimer()});
 for (var i:Number = 0; i < pLen; i++) {
  if (getTimer() - points*.life > 1000) {
   points.splice(i--, 1)[0];
  } else {
   if (i && points*) {
    points*.x += points*.vx;
    points*.y += points*.vy;
    var cx:Number = points[i - 1].x;
    var cy:Number = points[i - 1].y;
    this.curveTo(cx, cy, (points*.x + cx) / 2, (points*.y + cy) / 2);
   } else {
    this.moveTo(points*.x, points*.y);
   }
  }
 }
 prev_xmouse = this._xmouse;
 prev_ymouse = this._ymouse;
};
function randSet():Number {
 return arguments[Math.floor(Math.random() * arguments.length)];
}

http://www.ffiles.com/view_listing.php?sid=381&cat=74
:hoser:

You my good fellow, rock.

thanks!

One more thing though, I’ve played around with this code and tried a few different things, ive noticed this code doesnt work when I have a movieClip on the stage at the same time…

Ok just realised it IS working, just beneath what ive got on the stage… any way to bring it to a higher layer / level?

aaand… just been advised to put it in a movieclip, thanks again, i’ll shut up now.

Your welcome and glad you could find the solutions for your other questions :nat: