does anyone know how to get a list of active mouse event listeners?
i'm working on one (huge) flash project that includes windows-like flash user
interface, and i've come to following problem:
consider main.swf that dynamicly loads other swf file (i'll call it child.swf)
in empty movieclip (i'll call it myMc). that child.swf has its mouselistener
object created in standard way:
var mouseListener : Object = new Object();
mouseListener.onMouseWheel = function(delta) {
... something ...
}
Mouse.addListener(mouseListener);
when child.swf is unloaded from main.swf by calling unloadMovie(), all objects
from child.swf are destroyed, but mouseListener object still exists!
when loading child.swf second time (at runtime), mouseListener object is
created again, and now there are 2 same mouse listener objects, and all my code
inside onMouseWheel function now runs twice! of course, when unloading and
loading movieclip again, i have 3, 4 and more same onMouseWheel functions
running!
i spent whole day trying to figure out where the error is, and in the end i
figured that mouseListener object is not destroyed when unloading movieclip
that created it - it seems like a bug to me! it is same in flash player 7 and 8.
the situation is even worse because i've found no way of listing all mouse
listeners that are active at some moment.
of course, i could first remove that listener by calling something like
myMc.removeListener(mouseListener), before unloading the child movie, but i
would like to have a 'generic' function that would remove all listeners created
in some movieclip - otherwise my main.swf must know exact locations of all
listeners created in each child movieclip (thus, my 'close' function that
unloads movieclip cannot be generic!)
the problem is 'generic' since i'm working on interface in which main.swf
creates 'window-like' objects that can be dragged arround, and each of created
window objects has different swf loaded in some empty movieclip in it (some of
child movieclips have even more then one mouse listener - i'm using it for
controling scrollable texfield objects, and some child movieclips have more
than one scrollable textfield movieclip). when users press X (close button) on
each window object, window is unloaded, but listeners created in that swf still
exist!
has anyone come to similar problem (and solution?)