Procedural definition of Event Responses.

Is there a way I can create a procedure that I can call many times to define a button’s/sprite’s image, and event responses without having to create 50 events .click one for each button, this would be easy in a procedural language: GoSub, or an Oops Class?
It is easy enough to create a procedure for button images. See attachment.blocks


You can use Any Component blocks which allow you to define the component programmatically. You can store the components in a list and pull them with their tag that defined by you.



I hope that I am correct in assuming that you would like to set many images using one procedure that is run 50 (or many) times but is activated once?

I would personally do it the way yusufcihan mentioned and use a list, or use a while loop and if your component names only differ by an incremening number (eg sprite1,sprite2,sprite3…) You could just set the component name to (sprite+n) where n is a number that increases by 1 each loop and + is done by the join text block.

Now if you are using different images, I’m afraid I won’t be able to help. Best case for me I would name my images in a similar fashion to the sprites (image 1,image2…) But that may be confusing.

Hope you get the help you need.

as it has been already said, use the advanced features
How to work with the advanced features
A Multiple Choice Quiz: How to work with the advanced features