Question : Removing rollOver and rollOut handlers on movieclips

Greetings,

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.
Thanks
Mark







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: http://www.kirupa.com/developer/actionscript/asbroadcaster.htm), then you can set each event handler to an empty function, like this:

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