Button is not showing up,(setFillColor not working)

[lua]

display.setStatusBar(display.HiddenStatusBar)

local centerX = display.contentCenterX

local centerY = display.contentCenterY

–forward references

local buttons

local function mainmenu()

local background1 = display.newImage(“Background.png”)

background1.x = display.contentWidth / 2

background1.y = display.contentHeight / 2

buttons()

end

function buttons()

local widget = require( “widget” )

local function handleButtonEvent( event )

     if ( “ended” == event.phase ) then

         print( “Button was pressed and released” )

     end

end

local button1 = widget.newButton(

     {

         label = “button”,

         onEvent = handleButtonEvent,

         emboss = false,

         shape = “roundedRect”,

         width = 200,

         height = 40,

         cornerRadius = 2,

         fillColor = { default={1,0,0,1}, over={1,0.1,0.7,0.4} },

         strokeColor = { default={1,0.4,0,1}, over={0.8,0.8,1,1} },

         strokeWidth = 4

     }

)

button1.x = display.contentCenterX

button1.y = display.contentCenterY+150

– Change the button’s label text

button1:setLabel( “Shape” )

end

local function Ball()

local circle = display.newCircle(160,160,0)

circle.path.radius = 10

end

mainmenu()

[/lua]

this is my first project in corona and i have no idea where my mistake is  :mellow:

the button doesn’t show up, but it is there and it’s transparent, when i click around the area where i have placed my button it runs the statement (**print( “Button was pressed and released” )), **what i think is the function setFillColour is not working, because when i change it there is not effect on the button.

i have uploaded the image of this codes simulation.

Hi @ashfaaq.riphque,

I don’t see any call to “:setFillColor()” in the code sample you’ve provided…

Brent

im so sorry its not setFillColor(), its the fillColor and strokeColor in line 45 and 46

Hi again,

The problem might be somewhere else in your code. When I run only the code taken from the example in our documentation, it produces the correct button. Can you please confirm that running only these lines (no other code) produces a proper shape-based button?

https://docs.coronalabs.com/api/library/widget/newButton.html#shape

Thanks,

Brent

Hi @ashfaaq.riphque,

I don’t see any call to “:setFillColor()” in the code sample you’ve provided…

Brent

im so sorry its not setFillColor(), its the fillColor and strokeColor in line 45 and 46

Hi again,

The problem might be somewhere else in your code. When I run only the code taken from the example in our documentation, it produces the correct button. Can you please confirm that running only these lines (no other code) produces a proper shape-based button?

https://docs.coronalabs.com/api/library/widget/newButton.html#shape

Thanks,

Brent