Hey. I am using the random circle tutorial on my main page
http://www.cyberwebs.org but the .swf I made that I’ve imported into that site is from
http://www.cyberwebs.org
See how the .swf cuts off the cirlces when it goes past the boundary? Why won’t it do that on my site?
Here is the a/s
// special thanks to Suprabeener for the code
function getdistance(x, y, x1, y1) {
var run, rise;
run = x1-x;
rise = y1-y;
return (hyp(run, rise));
}
function hyp(a, b) {
return (Math.sqrt(a*a+b*b));
}
MovieClip.prototype.reset = function() {
// specify the width and height of the movie
width = 685;
height = 10;
// -------------------
var dist, norm;
this.x = this._x;
this.y = this._y;
this.speed = Math.random()*4+2;
this.targx = Math.random()*width;
this.targy = Math.random()*height;
dist = _root.getdistance(this.x, this.y, this.targx, this.targy);
norm = this.speed/dist;
this.diffx = (this.targx-this.x)*norm;
this.diffy = (this.targy-this.y)*norm;
};
MovieClip.prototype.move = function() {
if (_root.getdistance(this.x, this.y, this.targx, this.targy)>this.speed) {
this.x += this.diffx;
this.y += this.diffy;
} else {
this.x = this.targx;
this.y = this.targy;
if (!this.t) {
this.t = getTimer();
}
if (getTimer()-this.t>1000) {
this.reset();
this.t = 0;
}
}
this._x = this.x;
this._y = this.y;
};
I’ve tried changing the _‘root’ codes to _level15 (the level they are being loaded into…but it still doesn’t stay in the boundaries? Anyone have any suggestions?? This thing is giving me a headache!
:love: