Hey folks,

I just started programming (both PHP and javascript) less than a year
ago and have been able to cook up some stuff that impresses me, and
sometimes my wife.  But at the moment everything I do in mootools is
pretty much something like this:

$('something').addEvent('click',function(){
    // Do some stuff with other selectors and unmanageable code
});

... and then a lot of copy/pasting of the same code and then just
tweaking the selectors or adding a slight change.

I'll create functions for stuff that I use throughout an application
to avoid repetition, but seriously, there's a better way and I think
I'm ready to figure it out.  But I look at the stuff I create and
there's a voice saying my head "~Ryan ... you should just have a class
for this and save yourself tons of code~" and then I feel horrible
that my subconscious mocks me.

I think I understand what a class is, and for the most part how to use
one (after all, pretty much everything in mootools is a class).
However, the mootools docs don't help.  I'll never have a cat named
Micia in real life, let alone a web app.

I've tried dissecting other people's classes but when I look at the
code and try to tweak it there are strange pieces that don't make
sense to me and don't look very "moo"-ey.  The only javascript I
really know is mootools: "raw" javascript sticks out like a sore thumb
and my brain goes to mush.

I visited clientcide's "How to write a mootools Class" at
http://www.mootorial.com/wiki/mootorial/09-howtowriteamootoolsclass
but even then it's a little over my head. (i.e. on step two there's
slides[] on line 4 and slides[] on line 13.  Why?)

I'm going to keep poking that but in the meantime I'm looking for some
pointers and resources online.  Maybe even if somebody is willing to
let me send you my code, that I think ought to be a class, and then
help me write one or two.

Thanks so much!

Reply via email to