Hey !! i had the same problem , but in your code : heading.addEvent('click', function(){ // yada yada this.hideAll(i); -- 'this' is not the class , but rather the button !! // yada yada });
to solve it , you have a few options : 1. use that variable . // saving the this in a variable before we create the callback function . var that = this; heading.addEvent('click', function(){ // yada yada that.hideAll(i); // now that is know in the function , and its basicly your callback 'this' // yada yada }); 2. if you do something with the 'this' - you can use the call function . var that = this; heading.addEvent('click', function(e){ // use the this which is the button if needed. this.do_something_of_button(); that.hideAll.call(that,e); -- the hideAll function will run , and inside it the 'this' is the that you gave in the first argument ! // yada yada }); On Wednesday, September 12, 2012 11:06:24 PM UTC+3, Douglas Machado wrote: > > Greetings, > > I'm having a hard time to make a method to work correctly and I appreciate > if anyone could help me out; > > I have uploaded the script to this JSFiddle: > http://jsfiddle.net/machadoug/LPVkv/1/ > > It is not executing this method below > this.hideAll(i); > > Also, if I uncomment this.setOptions() I get this error in Firebug's > console: > > TypeError: this.setOptions is not a function > > > Thanks in advanced for your help, >