Hi guys, i’ve been playing around with this dynamic ribbon effect for some days now. It was made in Actionscript 2.0 for Flashplayer 6, now i need to change the Flashplayer to 8, because i made some other scripts which needs the new features in the new player.
But for some reason the animation is acting strange when i change the player. It is like it misses out just a tiny bit of the code, or some function. It is acting like it is stuck in the upper left corner all the time.
Working version (flashplayer6):
http://battin.dk/upload/test.swf
Strange acting version (flashplayer8)
http://battin.dk/upload/test2.swf
Fla here:
http://battin.dk/upload/test.fla
Code here:
stop();
p = new Array();
count = 0;
p[count] = {x:_xmouse, y:_ymouse, w:0, col:0};
count++;
rand = Math.random;
sin = Math.sin;
r = 255; //rand() * 128 + 127;
g = 127; //rand() * 128 + 127;
b = 0; //rand() * 128 + 127;
w = 0;
ri = 0.02; //rand() * 0.05;
gi = 0.015; //rand() * 0.05;
bi = 0.025; //rand() * 0.05;
this.onEnterFrame = function() {
vx = _xmouse - oldx + rand() * 2 - 1;
vy = _ymouse - oldy + rand() * 2 - 1;
oldx = _xmouse;
oldy = _ymouse;
p[count] = { x:_xmouse, y:_ymouse, vx:vx * 0.5, vy:vy * 0.5, w:(sin(w += 0.2)*5 + 5),
col:(sin(r += ri) * 128 + 127) << 16 | (sin(g += gi) * 128 + 127) << 8 | (sin(b += bi) * 128 + 127) };
count++;
clear();
moveTo(_xmouse, _ymouse);
for (var i in p) {
lineStyle(p*.w, p*.col);
p*.x += p*.vx;
p*.y += p*.vy;
if (p*.y > 1000) { // scene height
p*.y = 1000;
p*.vy *= -.5;
p*.vx *= .95;
}
if (i) curveTo(p*.x, p*.y, (Number(p*.x) + Number(p[i-1].x))/2, (Number(p*.y) + Number(p[i-1].y))/2);
if (p.length > 20) {// længde
p.splice(0, 1);
count--;
}
}
};
My best guess was this function:
if (p.length > 20) {// længde
p.splice(0, 1);
count--;
}
But it seems like it is not, since i tried to mess with it, and it doesnt change the problem. It is the function which defines the length of the trail.
This is inside the dot which makes the line:
this.onEnterFrame = function() {
_xscale = _yscale--;
_alpha--;
if (_xscale < 0 || _alpha < 0) removeMovieClip(this);
};
c = new Color(this);
c.setRGB(_root.p[_root.p.length-1].col);
I am sure you can spot the error instantly, thanks in advance.