Thanks Ryan,
Would you believe that I can actually follow what you did there! - I
must be starting to understand this :)

Chris

On 6 feb, 16:16, Ryan Florence <[email protected]> wrote:
> Keep plugging through `Class`.  There's no better way to develop than  
> with class.
>
> Here's another way of handling it:
>
> http://mootools.net/shell/BWLW3/4/
>
> 1.  Pulled the logic of the click event out into it's own method, the  
> binding happens with `var bound = `, notice that you can pass the  
> index through as a second argument (if you need more arguments, send  
> an array).
>
> 2.  Stored the click handler with each element so that you can  
> retrieve it later to remove it.  I think it's good practice to always  
> allow yourself (and others) the ability to detach any events the class  
> may have attached.
>
> ---
> Ryan Florencehttp://ryanflorence.com
>
> On Feb 6, 2010, at 6:27 AM, cbolson wrote:
>
> > Thanks Fábio,
> > Believe me when I say that I did try that (on my real code, though not
> > the demo that I knocked together for mooshell).
> > I must have had something else in there that was breaking it.  However
> > it works now.
>
> > Thanks again :)
>
> > Chris
>
> > On 6 feb, 13:54, Fábio M. Costa <[email protected]> wrote:
> >> addEvent is not like each, that you can pass a bind parameter to it.
> >> Its planed to do this, but i dont know when.
>
> >> Heres a working example:
>
> >>http://mootools.net/shell/BWLW3/2/
>
> >> --
> >> Fábio Miranda Costa
> >> Solucione Sistemas
> >> Engenheiro de interfaces
>
> >> On Sat, Feb 6, 2010 at 10:37 AM, cbolson <[email protected]> wrote:
> >>> Hi,
> >>> I am sure that this is a really basic problem but I am the first to
> >>> admit that I struggle when it comes to mootools Classes, especialy  
> >>> as
> >>> regards the "binding" :(
>
> >>> I have set up a simple demo:
> >>>http://mootools.net/shell/BWLW3/1/
>
> >>> The problem I am having is that I seem to loose the reference to
> >>> "this" (eg this.options") within the click event (see comments in
> >>> code)
>
> >>> I am getting this error in the consol: "this.contents is undefined"
> >>> I understand the error, I just can't seem to fix it :(
>
> >>> Any help appreciated on what is probably a simple error.
>
> >>> Thanks in advance,
>
> >>> Chris

Reply via email to