PDA

View Full Version : How do I turn this function off ????



dtrace
October 30th, 2008, 10:51 PM
var i:Number = 0;
onMouseDown = function () {
this.onEnterFrame = function() {
i++;
var b:MovieClip = this.attachMovie("brush", "brush"+i, this.getNextHighestDepth());
b._x = this._xmouse;
b._y = this._ymouse;
b._rotation = Math.floor(Math.random()*360);
b._xscale = b._yscale=Math.floor(Math.random()*40)+30;
b._alpha = Math.floor(Math.random()*40)+40;
};
};
onMouseUp = function () {
delete this.onEnterFrame;
};




This function basically attaches a movie clip from the library onto the mouse cursor when you drag. But how can I turn it off? And how can I remove the drawings it creates if I want to 'clear' everything?

This function is in a movieclip called 'we' on the root timeline.

Thanks.

theCodeBot
October 30th, 2008, 10:58 PM
This is AS2. It won't even work in AS3. But, since you're posting AS2, I'll give you the AS2 answer, if I can remember it anymore:

the deleter function (which needs to be this.onMouseUp, not just onMouseUp) just needs the line "removeMovieClip('brush'+i);"

I'd seriously consider moving on to AS3 though, things have seriously gotten a lot more powerful since.