I need two classes that comunicate between them with events(AS1, no AS2)… the idea is that one of them ClassA dispatch events and ClassB listen them…
if i have as actions in the satge:
// classA instance of ClassA and classB instance of ClassB
ASBroadcaster.initialize(classA);
classA.addListener(classB);
classA.eventX();
inside of ClassA:
ClassA.prototype.eventX = function() {
trace("Event dispatch by ClassA");
}
and inside of ClassB
ClassB.prototype.eventX = function() {
trace("Event dispatch by ClassA, listen by ClassB");
}
the result is:
Event dispatch by ClassA
Event dispatch by ClassA, listen by ClassB
that is that i want!!!. But if i do that ASBroadcast.initialize(…) is inside of ClassA:
ClassA = function() {
ASBroadcaster.initialize(this);
}
o
ASBroadcaster.initialize(ClassA.prototype);
and that
ClassB = function() {
// _objectA is a parameter of ClassB, and is the name of an object of ClassA
this.eval(this._objectA).addListener(this);
}
and in the stage only left:
classA.eventX();
is no more working!!!, only shows:
Event dispatch by ClassA
I don’t know which is the problem, anybody can help me??? Thanks