Originally Posted by
Suic
'If you wanted to limit object creation you could use a single or two static sliders instead of constructing one everytime draw instance is called. '
huh? im not constructing a slider everytime drawInterface() is called? it's literally constructed once and that is the addSlider() method when u create the interface, all preloaded.
also in terms of extending, theres really nothing to extend, minValue, maxValue, defaultValue is literally all the properties a slider would have, im using the 2 sprites aswell so it can be customized, so theres really no point in extending it now.
.
Code:
widget.widgetSlider = new WidgetSlider(minValue, maxValue, defaultValue, background, handle);
This is called when addSlider is called. Everytime you call addSlider you are constructing a new WidgetSlider.
Originally Posted by
Suic
'Another advantage you could use it to reject creation of an object when an invalid parameter is given, for example what if you do not want a default over 100?'
why would i have something like that(i understand it was just an example) but something like this definately shouldn't be an invalid parameter, what i can do is reject if null is passed as a parameter for the sprites for example.
Yeah see you're getting the idea now.