I am trying to make a button that has an elasticity effect like the buttons on THIS site (minus the horizontal movement). I got the following actionscript to make it work:

bounce = function (targetMC) {
_root.onLoad = function() {
speed = 4;
friction = 0.85;
home = 100;
};
this.onEnterFrame = function() {
if (targetMC.hitTest(_root._xmouse, _root._ymouse)) {
target = 150;
} else {
target = 100;
}
dif = target-targetMC._xscale;
vel = (vel+(dif/speed))*friction;
targetMC._xscale = targetMC._yscale += vel;
if (target == 150 && Math.abs(dif)<.5) {
target = 100;
}
};
};

bounce(myClip)

When I make a simple 1 frame test movie with the movie clip on one layer and the Actionscript on another, it works fine. But when I try to make it function as a button as well - I have trouble. What I did was create a button and then in the "over state", convert it into the elasticity movieclip. I tried putting the actionscript in the actionscript panel of the clip but it didn't work. I also tried putting the script in a frame of the clip but it didn't work either. What am I doing wrong?
Thanks!!!!
By the way, if anyone knows how to achieve that horizontal movement effect in the link I provided above I would love to know!!