onEnterFrame problems

I’m using onEnterFrame to initialize a function, but it’s adding all the other elements on the page and giving them the code as well. Why is it doing this and how do I make the object initialize the function locally (if thats the correct terminology).

CODE:

ball.onEnterFrame = function() {
vel.y+=gravity;
vel.x+=wind;
pos.x+=vel.x;
pos.y+=vel.y;
_x=pos.x;
_y=pos.y;
//
if (pos.y+radius > movie.height){
pos.y = movie.height-radius;
vel.y*=-_root.restitution;
}
if (pos.x+radius > movie.width){
pos.x = movie.width-radius;
vel.x*=-_root.restitution;
}
if (pos.x+radius < movie._x){
pos.x = movie._x-radius;
vel.x*=+_root.restitution;
}
//counter and wind change animation movement
counter–;
if (counter<0){
var newTime:Number=Math.random(30);
var newMinusTime:Number=Math.random(10);
counter=+newTime;
if (newMinusTime<3){
wind=-wind+newTime;
}
windChange();
}
}

It’s just a jaunt into gravity, nothing special! But I’m clearly doing something drastically wrong.