On Sep 20, 11:32 am, bluezehn <[EMAIL PROTECTED]> wrote:
> You haven't read the API well enough then. Separate files essentially
> mean very, very little.
>
> You need to keep a reference to the function that you set on the
> observer. What's important to realise here is that in javascript you
> have instances of functions, in exactly the same way as you might have
> an instance of a class in OOP. So you have something like:
>
> function foo()
> {...}
>
> var fooInst = foo;
> element#observe('event', fooInst);
> element#stopObserving('event', fooInst);
>
> as long as the fooInst variable is global, ie, referencable by any
> javascript anywhere, it doesn't matter where you stop observing it
> from.

Saying that a reference has to be "global" is a little confusing.
Reference is a reference. As long as it points to the same function
that was used in `Event.observe`, everything should work. It doesn't
really matter how you store that reference and where you store it : )

>
> Also, I believe in the latest version of prototype that:
> element#stopObserving()
> with no parameters, stops all observers on that element.

Yep.

--
kangax
--~--~---------~--~----~------------~-------~--~----~
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 prototype-scriptaculous@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to