# Problem with events and AS1

**URL:** <https://forum.kirupa.com/t/problem-with-events-and-as1/149378>\
**Category:** flash\
**Created:** [May 28, 2005, 1:36pm UTC](https://forum.kirupa.com/t/problem-with-events-and-as1/149378 "2005-05-28T13:36:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wolverine4277](https://avatars.discourse-cdn.com/v4/letter/w/ecccb3/32.png) [@wolverine4277](https://forum.kirupa.com/u/wolverine4277)\
**Post date:** [May 28, 2005, 1:36pm UTC](https://forum.kirupa.com/t/problem-with-events-and-as1/149378/1 "2005-05-28T13:36:26Z")

</div>

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
