Passing parameter to onEvent

Nobody seems to be in the UI section of the forums, so after waiting a few days, I think it’s appropriate to post here.

[code]
local brick_function = function (brick)
brick.isVisible = false
end

local brick_1 = ui.newButton{
default = “assets/level1_clickable_brick.png”,
over = “assets/level1_clickable_brick.png”,
onEvent = brick_function(brick_1),
id = “brick_1”
}[/code]

As you can see in my code, I have set the function for onEvent as brick_function, which carries a parameter. The function works when placed elsewhere, but when I put it in onEvent, it gives me a Runtime Error. Can you not pass parameters through onEvent? [import]uid: 7116 topic_id: 27352 reply_id: 327352[/import]

I believe that onEvent doesn’t accept parameters, no.

Is there a reason the brick has to be a ui button? It seems you are using the same image for “over” and “default” so perhaps you could just make it a standard image/object? [import]uid: 52491 topic_id: 27352 reply_id: 111116[/import]