Ok I finally realize that I don’t understand how the EventDispatcher works.
Or, perhaps, not fully understands it anyway.
I’ve created a custom class, lets call it Bounce. Everytime the ball hits the ground it broadcast the event Event.CHANGE as so:
Where disp is a EventDispatcher created when the class Bounce first is created.
Everything works great if I have once Bounce class object on the main timeline, if I add another one the CHANGE for the first one stops triggering but the last one added works instead.
var bouncyBall:Bounce = new Bounce(); var bouncyBall2:Bounce = new Bounce(); bounceyBall.addEventListener(Event.CHANGE, handler); // this works now bounceBall2.addEventListener(Event.CHANGE, handler); // after this line one bounceBall2 responds to the Event.CHANGE
Any clues what misstake I’m doing?