1. #1
    Ext User everrich's Avatar
    Join Date
    Aug 2008
    Posts
    70
    Vote Rating
    0
    everrich is on a distinguished road

      0  

    Default About FireEvent

    About FireEvent


    In function AAA
    Code:
    AAA = function(){
    this.addEvents('event');
    }
    Ext.extend(AAA,Ext.util.Observable,{
    ....
     this.fireEvent('event',parameter);
    ....
    })
    in function BBB
    Code:
    function BBB {
    var aaa = new AAA();
    aaa.on('event',function(parameter){
    ...})
    }
    I have a problem with this code. Function AAA fireEvent , but Function BBB didn't catch and process event "event".
    I don't know why? I need your help. Thanks
    I'm sorry, my English is not so good.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,948
    Vote Rating
    636
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Post your actual code.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    92
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Your code is correct (although it would be better if you called the superclass constructor):
    Code:
    AAA = function(config){
    	this.addEvents('event');
    	AAA.superclass.constructor.call(this, config);
    }
    Ext.extend(AAA, Ext.util.Observable, {
    	test: function(parameter){
    		this.fireEvent('event', parameter);
    	}
    });
    var aaa = new AAA();
    aaa.on('event', function(parameter){
    	alert(parameter);
    });
    aaa.test('Hello');

Thread Participants: 2