very weird problem with a button

hi guys i have a problem with a simple button. I created 2 differents button but they’re basically identical (the only thing that changes is the defaultFile and the overFIle) and they’re both connected to a function which should print 99 in the console, well just one of them works and they’re basically the same button. 

[lua] 

local buttonmtomm = widget.newButton

{ left = 50,

  top = -10,

  width = 63,

  height = 30,

  defaultFile = (“Sfondi/icons/m to mm.png”),

  overFile = (“Sfondi/icons/m to mm.png”),

  onEvent = handleButtonEventmtomm

}

local function handleButtonEventmtomm ( event )

local phase = event.phase 

if “ended” == event.phase then 

  print (99)

end 

end 

local buttontest= widget.newButton

{ left = 150,

  top = -10,

  width = 63,

  height = 30,

  defaultFile = (“Sfondi/icons/9.png”),

  overFile = (“Sfondi/icons/9.png”),

  onEvent = handleButtonEventmtomm

} [/lua]   ty all 

the quick fix is to move the ‘function’ block above both the button creations.  Scope issue - the first button is defined above the actual function so that button does not know the function exists.

local function handleButtonEventmtomm ( event ) local phase = event.phase if "ended" == event.phase then print (99) end end local buttonmtomm = widget.newButton { left = 50, top = -10, width = 63, height = 30, defaultFile = ("Sfondi/icons/m to mm.png"), overFile = ("Sfondi/icons/m to mm.png"), onEvent = handleButtonEventmtomm } local buttontest= widget.newButton { left = 150, top = -10, width = 63, height = 30, defaultFile = ("Sfondi/icons/9.png"), overFile = ("Sfondi/icons/9.png"), onEvent = handleButtonEventmtomm }

yes.   cyberparkstudios@gmail.com. or you could use the private message here on the corona site

ty i’ve sent u an email