Help with SetInterval / delete onEnterFrame

Hi,

Having some difficulty removing an onEnterFrame function for a scaling effect on a map. If I don’t remove it, the function seems to loop, causing massive resource usage and slowing down the HTML page its on.

What I want to do is let the function happen when a button is clicked, then for it to stop once its scaled once. The function has to be called from a zoom in, zoom out and a reset button.

I have the basic code below, but this isn’t working. Any help would be greatly appreciated.

 
//the zoom in button actions
zoomIn_btn.onPress = function() {
 clearInterval(zoomInterval);
 zoomInterval = setInterval(_root, "zoomIn", 100);
 zoomIn();
 nicescale();
};
//the scaling effect
function nicescale() {
 map_mc.onEnterFrame = function() {
  this._xscale = this._yscale += (this.scale-this._xscale)/2;
  if (this.activeMovement) {
   this._x += (this.x-this._x)/2;
   this._y += (this.y-this._y)/2;
  }
 };
};
//remove the scaling effect
function removescale() {
 delete map_mc.onEnterFrame;
 scaleInterval = setInterval(_root, "scaleInterval", 100);
}

I know I need to call the ‘removescale’ function, but at the moment it’s not working so I’ve removed it from the zoomIn_btn.onPress function.

cheers,
iain