Multiple dispatching issue
Posted
by
user1440263
on Stack Overflow
See other posts from Stack Overflow
or by user1440263
Published on 2012-06-25T09:00:55Z
Indexed on
2012/06/25
9:16 UTC
Read the original article
Hit count: 262
actionscript-3
|flash
I try to be synthetic:
I'm dispatching an event from a MovieClip (customized symbol in library) this way:
public function _onMouseDown(e:MouseEvent){
var obj = {targetClips:["tondo"],functionString:"testFF"};
dispatchEvent(new BridgeEvent(BridgeEvent.BRIDGE_DATA,obj));
}
The BridgeEvent class is the following:
package events {
import flash.events.EventDispatcher;
import flash.events.Event;
public class BridgeEvent extends Event {
public static const BRIDGE_DATA:String = "BridgeData";
public var data:*;
public function BridgeEvent(type:String, data:*) {
this.data = data;
super(type, true);
}
}
}
The document class listens to the event this way:
addEventListener(BridgeEvent.BRIDGE_DATA,eventSwitcher);
In eventSwitcher method I have a simple trace("received").
What happens: when I click the MovieClip the trace action gets duplicated and the output window writes many "received" (even if the click is only one).
What happens? How do I prevent this behaviour? What is causing this?
Any help is appreciated.
[SOLVED] I'm sorry, you will not believe this. A colleague, to make me a joke, converted the MOUSE_DOWN handler to MOUSE_OVER.
© Stack Overflow or respective owner