I think this is a pretty simply problem but I do not seem to be able to pull it off. Basically I have a parent class A, and a child class B. Class A instantiates class B with addChild. There is a shared object which is being updated from a java server (red5) that has an event listener attached to it in class A. I have a function in class A which will pass certain, specific updates from this shared object to class B. The problem occurs is that when class B is instantiated, the event listener from class A doesn't work anymore. I have not removed the event listener from A. Any thoughts?
A:
So it seems that your class B tampers with the shared object or perhaps with the connection to the Java server? Just instantiating a class should of course not interfere with anything that it has no access to.
You need to take a closer look at what dependencies B has. Does it reach into global state? (That's a bad thing from an oop perspective). Does it do any work inside its constructor that makes the updating stop working? Does it inherit some other class that does any of the above? Investigate this and you should probably find the culprit.
bitc
2010-04-30 21:40:59