# How to customize a newSlider

**URL:** <https://forums.solar2d.com/t/how-to-customize-a-newslider/301932>\
**Category:** Composer\
**Created:** [April 15, 2012, 1:18am UTC](https://forums.solar2d.com/t/how-to-customize-a-newslider/301932 "2012-04-15T01:18:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephane.martin23](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/s/7993a0/32.png) [@stephane.martin23](https://forums.solar2d.com/u/stephane.martin23)\
**Post date:** [April 15, 2012, 1:18am UTC](https://forums.solar2d.com/t/how-to-customize-a-newslider/301932/1 "2012-04-15T01:18:39Z")

</div>

Hello,

I’m using build 2011.704 and want to customize the look of a newSlider using leftImage, rightImage, handleImage,… :

local myleftImage = {“left.png”,100,100}  
local mySlider = widget.newSlider{  
width=200,  
value=100,  
leftImage = myleftImage,  
callback=sliderListener  
}

But I get the following error :  
ERROR: bad argument #2 to display.newImageRect(): width expected, but got nil.  
Runtime error  
?:0: attempt to index a nil value  
stack traceback:  
[C]: ?  
?: in function ‘new’  
?: in function \<?:2530\>  
(tail call): ?  
d:\corona\projet1\main.lua:402: in main chunk

Can anyone help me ?  
Thank you!  
[import]uid: 49426 topic\_id: 24883 reply\_id: 324883[/import]

---

<div class="post-metadata">

**Author:** ![stephane.martin23](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/s/7993a0/32.png) [@stephane.martin23](https://forums.solar2d.com/u/stephane.martin23)\
**Post date:** [April 20, 2012, 2:05pm UTC](https://forums.solar2d.com/t/how-to-customize-a-newslider/301932/2 "2012-04-20T14:05:05Z")

</div>

This problem is now solved by removing widget\_ios directory from my projet directory and copying my customs pngs in the projet directory.

widget.setTheme( “theme\_ios” )  
local myleftImage = {“slider-left.png”,100,0, 100}  
local myrightImage = {“slider-right.png”,100,0, 100}  
local myfillImage = {“slider-fill.png”,100,0, 800}  
local mymaskImage = {“slider-mask.png”,100,100, 900}  
local myhandleImage = {“slider-handle.png”,105,0, 105}

local AlphaSlider  
local function createAlphaSlider()

alphaSlider = widget.newSlider{  
width=alphaSlider\_width,  
height=toolbar\_button\_height,  
value=100,  
leftImage = myleftImage,  
rightImage = myrightImage,  
fillImage = myfillImage,  
maskImage = mymaskImage,  
handleImage = myhandleImage,  
callback=sliderListener  
… [import]uid: 49426 topic\_id: 24883 reply\_id: 102311[/import]
