I created two classes: A ButtonGenerator and a Button. The Button is a 
child of ButtonGenerator. When Button is instantiated and an event listener 
is attached in ButtonGenerator, Button does not appear to capture the 
fireEvent from Button.initialize. 

var ButtonGenerator = new Class({
Implements:[Events], 
 initialize:function(){
this.button = new ButtonGuide(); 
this.button.addEvent('buttonReady', function(){
console.log('meh'); 
}); 
}); 

var Button = new Class({
Implements:[Events], 
 initialize:function(){
this.fireEvent('buttonReady'); 
}
}); 

Why won't this work? Is it because the event listener is attached after 
Button.initialize completes? What is a better way to do this? 

Reply via email to