Little code problem i can't figure out

Ok so this is the code i made, and everything is working well except for 1 thing :frowning: Heres the code (copy and past it to flash to see what it does)…

[AS]
x1 = 100;
y1 = 200;
x2 = 400;
y2 = 200;
_root.onEnterFrame = function() {
_root.createEmptyMovieClip(“line”+i, i);
trace(“controlx=”+controlx);
trace(“mousex=”+_root._xmouse);
controlx = _root._xmouse2-(x2-x1)/2;
controly = _root._ymouse
2-(y2-y1)/2;
_root[“line”+i].lineStyle(2, 0x00FF00, 80);
_root[“line”+i].moveTo(x1, y1);
_root[“line”+i].curveTo(controlx, controly, x2, y2);
alphaFade(_root[“line”+i]);
i++;
if (i>1000) {
i = 0;
}
};
MovieClip.prototype.alphaFade = function(fadingLine) {
fadingLine.onEnterFrame = function() {
fadingLine._alpha -= 10;
if (fadingLine._alpha<=0) {
fadingLine.clear();
}
};
};
[/AS]

The problem is, i can’t get the mouse to be the same point as the control point. Without the alpha fading, it works, but without, it doesn’t :-\ Very frustrating. hope someone can help! thanks ! :beam:

if you want the mouse to be the same as the control point, then you don’t need that formula to calculate controlx and control y
[AS]
x1 = 100;
y1 = 200;
x2 = 400;
y2 = 200;
_root.onEnterFrame = function() {
_root.createEmptyMovieClip(“line”+i, i);
trace(“controlx=”+controlx);
trace(“mousex=”+_root._xmouse);
controlx = _root._xmouse//*2-(x2-x1)/2;
controly = _root._ymouse//*2-(y2-y1)/2;
_root[“line”+i].lineStyle(2, 0x00FF00, 80);
_root[“line”+i].moveTo(x1, y1);
_root[“line”+i].curveTo(controlx, controly, x2, y2);
alphaFade(_root[“line”+i]);
i++;
if (i>1000) {
i = 0;
}
};
MovieClip.prototype.alphaFade = function(fadingLine) {
fadingLine.onEnterFrame = function() {
fadingLine._alpha -= 10;
if (fadingLine._alpha<=0) {
fadingLine.clear();
}
};
};


now, if you want the mouse to be at the peak of the curve, you would use this.

x1 = 100;
y1 = 200;
x2 = 400;
y2 = 200;
_root.onEnterFrame = function() {
_root.createEmptyMovieClip(“line”+i, i);
trace(“controlx=”+controlx);
trace(“mousex=”+_root._xmouse);
controlx = _xmouse2-(x1+x2)/2;
controly = _ymouse
2-(y1+y2)/2;
_root[“line”+i].lineStyle(2, 0x00FF00, 80);
_root[“line”+i].moveTo(x1, y1);
_root[“line”+i].curveTo(controlx, controly, x2, y2);
alphaFade(_root[“line”+i]);
i++;
if (i>1000) {
i = 0;
}
};
MovieClip.prototype.alphaFade = function(fadingLine) {
fadingLine.onEnterFrame = function() {
fadingLine._alpha -= 10;
if (fadingLine._alpha<=0) {
fadingLine.clear();
}
};
};


if this is what you mean, you almost had it except for you were subtracting instead of adding in these two lines

    controlx = _xmouse*2-(x1+x2)/2;
    controly = _ymouse*2-(y1+y2)/2;

APdesign yet again comes to the rescue :stuck_out_tongue: thank you…i knew it was something small! these little things annoy me :m: