내가 왜 내 버튼을 누르면 모양이 바뀌지 않는지 알 수 없습니다. 다음 스 니펫에 문제가있을 경우 아무에게 말해 줄 수 있습니까? 코로나 SDK를 사용 중입니다.코로나 간단한 eventListener
이것은 내 전체 main.lua입니다. 이벤트 리스너를 제거하면 buttonswap이 작동합니다.
display.setStatusBar(display.HiddenStatusBar);
local textObj = display.newRetinaText("Click and see what happens!", 40, 40, nil, 0)
textObj:setTextColor(255,0,0);
local widget = require "widget";
local button = widget.newButton{
default = "Button.png",
over = "ButtonClicked.png",
onPress = button.touch;
}
button.x = display.contentCenterX;
button.y = display.contentCenterY+200;
local function touch(e)
if(e.phase == "began")then
textObj.text = "Clicked!";
textObj:setTextColor(255,255,255);
elseif(e.phase == "ended") then
textObj.text = "Released!";
textObj:setTextColor(255,0,0);
end
end
이제는 버튼이 아니라 텍스트 만 볼 수 있습니다.
오른쪽 main.lua이고 ButtonClicked는 주 파일과 같은 폴더에 있습니다 ... 이상한 – Eyeball
제 편집을 참조하십시오! – Eyeball
eventlistener가 내 단추 정의를 재정의합니까? 이 경우 어떻게 해결할 수 있을까요? – Eyeball