Hi,
In your original thread, you replied to my question:
> > Are these event handlers, or are you calling them directly? If you're
> > calling them directly from other code, you probably want bind() rather
> > than bindAsEventHandler().
>
> To be honest I can't tell the difference. But no I don't think they
> are events they are callbacks I can register so I'm not calling them
> directly from my code. The slider.js merely provides them. I think I
> already tried bind() and got the same result as with
> bindAsEventHandler(). The second parameter got lost.
I don't think the parameter got "lost" -- the calling code defines
what parameters get passed to the function, remember. If the
callbacks are documented that they only get one parameter, that's all
they're going to get, even if your function declares more (or indeed
fewer) parameters.
From your original description, what you want is bind() and then use
"this.sliders" to access the sliders within the handler. Get a bound
version of handleSliderChange:
boundHandler = handleSliderChange.bind(this);
...and then use it for the callbacks:
this.sliders[i].ctrl.options.onSlide = boundHandler;
this.sliders[i].ctrl.options.onChange = boundHandler;
...and then use this.sliders in your handleSliderChange.
Caveat: I've never used
script.aculo.us sliders, but generically
speaking I'd expect the above to work.
Hope this helps,
--
T.J. Crowder
tj / crowder software / com
On Jul 7, 6:10 pm, "
seb.scha...@googlemail.com"