Making functions that use paths

Hi, I decided to make a function that would take a movieclip and move it with the specified speed from its current location to a specified x and y location. I figure it could come of use to me. So that would look something like this


function travelTo(x, y, speed) {
//bla bla
}

But what I also want to do is to be able to tell a certain movieclip to travel somewhere (that’s kind of the whole point), so if I had a movie clip with the name of ball i could just call it like _root.ball.travelTo(200, 200, 2)
Now how do I make the function so that I can call it with _root.bla-bla.bla-bla… ?