Question : Removing rollOver and rollOut handlers on movieclips


I have movieclips that make up a background to a site and they're scripted as below:

var numObjects:Number = 2871;

for (var i:Number = 1; i <= numObjects; i++)
     var mc:MovieClip = this["p" + i];
     mc.onRollOver = rollOverHandler;
     mc.onRollOut = rollOutHandler;

function rollOverHandler()
      // "this" will refer to the object on which event is invoked
      this._xscale = _xscale+65;
      this._yscale = _yscale+65;
function rollOutHandler() {
      this._xscale = _xscale-0;
      this._yscale = _yscale-0;

I would like to make the rollOver and rollOut handlers for the above movieclips become inactive once I load a movieclip from the library into another clip holder placed on the stage.
Any ideas would be greatly appreciated.

Answer : Removing rollOver and rollOut handlers on movieclips

If you're not into using event listeners and broadcasters (see this example for a good education on this advanced technique:, then you can set each event handler to an empty function, like this:

mc.onRollover = function() { }
mc.onRollOut = function() { }
Random Solutions  
programming4us programming4us