Need help with procedures/variables

Hi, I’m new to Kodular/App making, but I am an experienced developper. I wondered, is there any way to turn this code (see below) into a procedure with two parameters :

  • index, as an integer
  • element, a reference to BS5 (a button element)
    I managed to create a procedure with this two arguments, but it turns out I can’t create a block that does set [element].backgroundColor to [red]
    If creating such a block was possible, I could write this bit of code as a function, and then I could simply paste it into the code for BS1, BS2, BS3 and BS4 !

I sincerely hope I made it comprehensible ! Thank you in advance for you help !
(oh and btw, english is not my primary language so excuse any mistakes)
blocks

You can use the Any Component blocks as well. These are generic blocks that provide inputs, one of which specifies the component.

blocks (2)

To get Any Component blocks:

Animation

To add inputs to a procedure, click on the blue gear.

Nevermind, I found a solution using dynamic buttons