Nine Slice Buttons

A gfx artist recently made me some nine slice buttons. He says

 “I already defined the slice regions. This means you can scale the dimensions of the object how you want and it should look uniform as you do so.”

They are named as button.9.png 

I believe these buttons are made in a way that you are not supposed to have to do anything other than plug and play them… I dont know how to use them though. 

btnSubmit1 = display.newImageRect(“res/drawable/btn_submit.9.png”, 166, 166)

Using the button like this does not seem to work… as the button distorts around the corners as usual…

Is it possible to take advantage of the nine slice button as it is currently made?.. Is corona able to use these .9.png’s as intended?

Or will I have to use the widget API… and give a list of options defining the nine slice regions?

display.newImageRect has no concept of slicing. You need to use the widget API or do the slicing yourself (with image sheets). Either way you have to specify the slice regions manually, as there is no way to deduce them from the image.

Take a look at the widget.newButton API doc : http://docs.coronalabs.com/api/library/widget/newButton.html#slice-construction

The sample there will show you to to work with your own image. Best of luck. 

display.newImageRect has no concept of slicing. You need to use the widget API or do the slicing yourself (with image sheets). Either way you have to specify the slice regions manually, as there is no way to deduce them from the image.

Take a look at the widget.newButton API doc : http://docs.coronalabs.com/api/library/widget/newButton.html#slice-construction

The sample there will show you to to work with your own image. Best of luck.