I have a proble with a “simple” mouseListener.
I’ve create a class. I’ve attached the class to a movieClip. The movieClip is used in a swf file I called “0_gioco.swf”.
“0_gioco.swf” is loaded into “main.swf”.
In main.swf I have a botton to exit (remove) from “0_gioco.swf” and then I can reload it.
The problem is that when I reload “0_gioco.swf” it doesn’t work because the mouseListener that is called in the class has not be removed.
Any idea?
Thanks.
Alberto.
The code:
[SIZE=3]abbinaSpot.as[/SIZE]
[…]
public function abbinaSpot() {
Mouse.removeListener(this._parent.mouseListener);
Mouse.removeListener(this._parent.pointer.mouseListener);
delete mouseListener;
mouseListener = new Object;
mouseListener._parent = this;
mouseListener.onMouseMove = function () {
this._parent._x=this._parent._parent._xmouse;
this._parent._y=this._parent._parent._ymouse;
};
mouseListener.onMouseDown = function () {
trace("mouse giu"+this);
this._parent.controlla();
};
Mouse.addListener(mouseListener);
}
public function controlla() {
this._parent.outSpot="controllato";
this.cliccato="nulla";
trace("e' uguale a nulla? "+this.cliccato)
[…]
[SIZE=3]**main.fla
**[SIZE=2]function mappa(){
chiudi._visible=false;
this.inMappa=true;
suonoBase();
carico(“mappa”);
[/SIZE][/SIZE]}
[SIZE=3][/SIZE]function caricaGioco(){
[…]
carico(gioco+"/"+gioco+"_gioco")
}
function carico (chi:String) {
dove.removeMovieClip();
_root.createEmptyMovieClip(“dove”, doveDepth);
my_mcl = new MovieClipLoader();
theListener = new Object();
my_mcl.addListener( theListener );
my_mcl.loadClip(chi+".swf", dove);
[…]