hello,
I try to build a naviagtion build of little dots.
I want them to be magnet and it works fine. I took this script:
onClipEvent (load) {
radius = 30;
startX = _x;
startY = _y;
}
onClipEvent (enterFrame) {
distance = Math.sqrt(Math.pow(_root._xmouse-startX, 2)+Math.pow(_root._ymouse-startY, 2));
if (distance<radius) {
_x += _xmouse/3;
_y += _ymouse/3;
} else {
_x += (startX-_x)/3;
_y += (startY-_y)/3;
}
}
but I wan´t to move the buttons randomly in a small radius, I tried to put this script also on the MC:
onClipEvent (load) {
xMax = 550;
yMax = 400;
xMin = 0;
yMin = 0;
hispeed = 8;
loSpeed = 6;
traegheit = 0.1;
grenzen = this.getBounds (this);
}
onClipEvent (enterFrame) {
xSpeed += ( xDrive - xSpeed ) * traegheit;
ySpeed += ( yDrive - ySpeed ) * traegheit;
if ( _x + grenzen.xMax + xSpeed > xMax|| _x + grenzen.xMin + xSpeed < xMin ) {
xSpeed *= -1;
xDrive *= -1;
}
if( _y + grenzen.yMax + ySpeed > yMax || _y + grenzen.yMin + ySpeed < yMin ) {
ySpeed *= -1;
yDrive *= -1;
}
_x += xSpeed;
_y += ySpeed;
if ( xDrive - xSpeed < 0.1 && xDrive - xSpeed > -0.1 && yDrive - ySpeed < 0.1 && yDrive - ySpeed > -0.1 ) {
do {
xDrive = Math.random () * hiSpeed;
xDrive *= ( Math.random () > .5 ) ? 1 : -1;
yDrive = Math.random () * Math.sqrt (Math.pow ( hiSpeed, 2) - Math.pow (xDrive, 2) );
yDrive *= ( Math.random () > .5 ) ? 1 : -1;
} while ( Math.sqrt ( Math.pow ( xDrive, 2 ) + Math.pow (yDrive, 2 ) ) < lospeed );
}
}
but when I put both scripts on the MC nothing happens anymore, I think they are blocking each other. Is it possible, that the MC´s are doing both?
thanx