Hi, The problem isn't in the declaration of the properties, it's in how you're calling the `show` function. You're calling it without ensuring that `this` has the correct value. Details and solution here:
http://blog.niftysnippets.org/2008/04/you-must-remember-this.html HTH, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Oct 18, 11:25 pm, houpdelta <[email protected]> wrote: > Hi, > > i have a problem. I have been searching for a solution on the web but > couldn't find it. > > i declare a class, but the property (this.number) and the function > (this.hideAllOthersUls) are not recognized > > example : > > var Menu = Class.create({ > initialize: function(css) { > this.number = 13; > > // get some element > var menu = $(css); > var items = menu.select('li'); > > items[0].observe('keyup', this.show, false); > }, > > show: function() { > alert(this.number); > this.hideAllOthersUls(); > }, > > hideAllOthersUls: function (){ > alert('ok'); > } > > }); > > if I test , alert() in function 'show' returns 'undefined' and > 'this.hideAllOthersUls();' returns "is not a function". > > Do you kown a good example for declaring a property ? or do you have a > good solution ? > > Thanks > > Laurent -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
