@David-Healey Yeah, me too. But I thought for someone learning how to do the basics of optimising repetitive code into loops, I would just show the basic method.
@goldee What David means, if we're talking about the same thing, is that you can get an array of components and loop through them directly, instead of fetching each one by name.
const panels = Content.getAllComponents("instimg_pnl\\d+"); for (panel in panels) { panel.loadImage("{PROJECT_FOLDER}" + panel.getId() + ".png", "img"); panel.setPaintRoutine(function(g) { var a = this.getLocalBounds(0); g.drawImage("img", a, 0, 0); }); }