Naturally, I figured it out after posting...
Working from the example code on the wiki, I set a variable to the
'new Slider...' and then updated the handles property of that variable
after each click on a control.
var mySlider = new Control.Slider(rgb_slider.select('.handle'),
rgb_slider, {
range: $R(0, 255),
sliderValue: [45, 134, 189],
onSlide: function(values) {
box.setStyle({ backgroundColor: "rgb("+
values.map(Math.round).join(',') +")" });
},
onChange: function(values) {
box.setStyle({ backgroundColor: "rgb("+
values.map(Math.round).join(',') +")" });
}
});
$('add').observe('click',function(evt){
var h = new Element('div',
{'class':'handle'}).setStyle({backgroundColor:'#00f'});
rgb_slider.insert(h); mySlider.handles.push(h)
});
Walter
On Jan 14, 2009, at 10:38 AM, Walter Lee Davis wrote:
>
> Can you register additional handles after the fact, or do you
> need to run the constructor again?
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---