When creating a new button with ui.newButton where can I find documentation about all the events that are supported. Right now I know 2: onEvent & onPress. Are there anymore?
local typeButton1 = ui.newButton{
default = “Images/Player1-Piece1-0.png”,
over = “Images/Player2-Piece1-0.png”,
onEvent = buttonHandler,
text = “”,
id = “button1”,
}
local typeButton1 = ui.newButton{
default = “Images/Player1-Piece1-0.png”,
over = “Images/Player2-Piece1-0.png”,
onPress = buttonHandler,
text = “”,
id = “button1”,
} [import]uid: 295 topic_id: 1343 reply_id: 301343[/import]
The supported events are: onPress, onRelease, and onEvent.
The best place to find the information in the source code: ui.lua (included in the Corona SDK). You can also add your own events.
Yeah. I saw that later. Also, something I found out the hard way is that using ‘onPress’ and ‘onRelease’ cause different things to happen then when using ‘onEvent’:
local button1 = ui.newButton{
default = “Button1.png”,
over = “Button1Over.png”,
onEvent = button1Handler,
text = “”,
id = “button1”,
}
local button2 = ui.newButton{
default = “Button2.png”,
over = “Button2Over.png”,
onRelease = button2Handler, – or onPress
text = “”,
id = “button2”,
}
local button1Handler = function(event)
print(“id = " … event.id …”, phase = " … event.phase )
end
local button2Handler = function(event)
print(“id = " … event.id …”, phase = " … event.phase )
– THIS ‘print’ STATEMENT WILL CAUSE AN ERROR BECAUSE ‘event.id’ AND ‘event.phase’ INFORMATION
– ISN’T RETURNED WITH ‘onPress’ OR ‘onRelease’ EVENTS TYPES.
– ‘event.id’ AND ‘event.phase’ INFORMATION IS RETURNED ONLY WITH THE ‘onEvent’ EVENT TYPE.
end
[import]uid: 295 topic_id: 1343 reply_id: 3662[/import]
I had chosen to ignore all of ui anyway… Make it yourself and you know how it works… This “I’d” thing was added lately as far as I remember … I think it. Is much better to compare with event.target than to introduce additional I’d values and carry them around… [import]uid: 6928 topic_id: 1343 reply_id: 3675[/import]
I really love to read articles logo design that have good information and ideas to share to each reader. I hope to read more from you guys and continue that good work that is really inspiring to us.
[import]uid: 12172 topic_id: 1343 reply_id: 13185[/import]