Hi, I’m having and issue with AsBroadcaster. I’m trying to get different instances of the same MovieClip to respond to an event. The problem is, I can only ever get one to respond.
Here is the class for the mc broadcasting the event;
class DispatchClass extends MovieClip {
private static var events:Object;
public function DispatchClass () {
events = new Object();
AsBroadcaster.initialize(events);
}
public function onRelease () {
events.broadcastMessage("pressed");
}
public function addListener(listener:Object){
events.addListener(listener);
}
}
and here is the class for the receiving MCs:
class listenerClass extends MovieClip {
public function listenerClass () {
var obj1:DispatchClass = new DispatchClass();
var thisObj = this;
var listener1:Object = new Object();
listener1.pressed=function(){
trace("
thisObj = " + thisObj + "
");
};
obj1.addListener(listener1);
}
}
I’m sure it’s something easy I just can’t seem to get around it. Any help would be much appreciated. Thanks, Todd.