how to add onclick event on object A by another object B？
I want to write some Onclick event on object A by another object B.
The questions I face Is that I want to generate some rectangles by a button, then I want to apply Onclick function on those rectangles. So when I click the rectangles it will rotate 90ﾟ.
I have done the previous Step to generate the rectangle by the bottom. But since the rectangle is new object I can't write down the onclick function before it's generate.
So I'm finding some Way to edit the onclick function on rectangles by other object, I have found some JS function like ObjectOnclickListener but I don't really know how to use it as well.
Is it possible to edit by js?
sorry that my English is poor, and thanks for help.