change widget.newButton newButton image

Hi guys! I need to change my widget.newButton’s image after taping on it to show that it’s active (pressed) now, because we have only 2 states of button now (default, over) I try to do this way

myBtn = widget.newButton{  
 id = "myBtn",  
 left = 255,  
 top = 58,  
 width = 44,  
 height = 44,  
 default = "image1.png",  
 over = "image2.png",  
 onEvent = onBtn  
}  
  
-- trying to change image after tap to image3.png  
local onBtn = function( event )  
 myBtn.default = "image3.png"  
end  

trick with .default property does’s work, console shows this error
[text]
Runtime error
?:0: attempt to index field ‘default’ (a string value)
stack traceback:
[C]: ?
?: in function <?:191>
?: in function <?:226>
[/text]

Any ideas? [import]uid: 39634 topic_id: 26587 reply_id: 326587[/import]

up! [import]uid: 39634 topic_id: 26587 reply_id: 108105[/import]

Currently, there is no way to change the initial images you set for the button widget (we’ll take that as a feature request though!).

One thing you can do is in the listener for your button, remove it and recreate a different button (or create both buttons, and have the listener for each hide one button and show the other). [import]uid: 52430 topic_id: 26587 reply_id: 108319[/import]

OK, will greatly appreciate that feature request! also please don’t forget about button’s disabled state with it’s appropriate image.

Thank you! [import]uid: 39634 topic_id: 26587 reply_id: 108436[/import]