3d in flash

Supposing that on the following tutorial: http://www.kirupa.com/developer/actionscript/shape_camera.htm

Im wanting the function backAndForth to execute onRelease instead of onEnterFrame.

I have changed

theScene.Joe.onEnterFrame = backAndForth

to

theScene.Joe.onRelease = backAndForth

But on release the camera hardly moves, and you have to keep clicking the mc to get to the desired position. How can I get to so it moves smoothly, only having to click it the once.

Heres all the code for the tutorial:

theScene.Joe.x = 0;
theScene.Joe.y = 0;
theScene.Joe.z = 500;
 
cameraView = new Object();
cameraView.x = 0;
cameraView.y = 0;
cameraView.z = 500;
focalLength = 300;
dir = -1;
speed = 20;
 
backAndForth = function(){
 cameraView.z += speed*dir;
 if (cameraView.z > 500){
  cameraView.z = 500;
  dir = -1;
 }else if (cameraView.z < 0){
  cameraView.z = 0;
  dir = 1;
 }
 var scaleRatio = focalLength/(focalLength + this.z - cameraView.z);
 this._x = (this.x - cameraView.x) * scaleRatio;
 this._y = (this.y - cameraView.y) * scaleRatio;
 this._xscale = this._yscale = 100 * scaleRatio;
};
theScene.Joe.onEnterFrame = backAndForth;

Thanx :cool: