Answer the question
In order to leave comments, you need to log in
Why is there an error in corona sdk?
local widget = require("widget")
-- фон приложения
display.setDefault("background", 37/255, 39/255, 46/255)
-- цвет текста по умолчанию
display.setDefault("fillColor", 0)
number = 9;
numberMinusButton = widget.newButton {
shape = 'roundedRect', -- форма кнопки
raidus = 5, -- радиус скругления уголков
width = 60, height = 60, -- размеры кнопки
left = 19, top = 90, -- положение кнопки
fontSize = 40, -- размер шрифта
fillColor = { default={ 150/255 }, over={ 76/255 } }, -- цвет кнопки
labelColor = { default={ 0 }, over={ 1 } }, -- цвет текста
label = 'adf', -- текст на кнопке
-- нажатие на кнопку
onPress = function(event)
if number ~= 0 then
number = number - 1;
print(number)
mynumber.text = number
end
end
}
local options =
{
parent = numberGroup,
text = number,
x = display.contentCenterX,
y = 53,
font = native.systemFont,
fontSize = 50,
}
local mynumber2 = display.newText( options )
mynumber2.y = 70
local mynumber = display.newText( options )
mynumber:setFillColor( 255, 255, 255 )
Answer the question
In order to leave comments, you need to log in
mynumber needs to be raised higher in the file, higher than the button, otherwise the text object is simply not visible to the button. Or use forward declaration.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question