Hi, Provided the code is in the order you're showing it and you don't assign some other value to `discardAll` later, that should work; here's a stand-alone example (not using Lightview, but using custom events): http://jsbin.com/awiqi4
Somewhat off-topic, but unless you have a good reason to do the function expression (`var discardAll = function`...), use a function declaration instead (`function discardAll`...), as here: http://jsbin.com/awiqi4/2 But it doesn't matter for the problem you've outlined, unless the code is in a different order than shown. FWIW, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Dec 7, 3:56 pm, Luke <kickingje...@gmail.com> wrote: > Hi, > > I'm doing an internship in a company where they bought a script for > modals called 'Lightview' (http://www.nickstakenburg.com/projects/lightview/ > ), so I'm kinda stuck with using it. The problem is that instead of > many other libraries, you cannot pass lightview any callbackfunctions > as parameters. That means the only way to react on, lets say, when > lightview is done opening or closing is to observe global events that > will be fired in such cases. > > So if I want to do something when lightview closes I need to observe > 'lightview:hidden', but I do not -always- react on this event with a > given behaviour since there are many cases for which lightview is > shown. I just want to react to the close even just this one time. > > So I thought, maybe I could write an observer, that "kills" its self > after it has been executed. I tried this: > > var discardAll = function(event) { > // Do stuff > document.stopObserving('lightview:hidden', discardAll); > > } > > document.observe('lightview:hidden', discardAll); > > But this doesn't work. I must say I don't really have much clue of > stoping specific observers in the first place, so I'm wondering if > this is even the right way to stop an observer > > Thanks, > Lukas -- 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-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.