I'm having problems adding functions to newly generated buttons
Code: Select all
for(i = 0; i < files.length; i++){
var buttonX = mainWindow.add("button", undefined, presets[i]);
buttonX.onClick = function(){
mainLayer.applyPreset(presets[i]);
}
};
I want that when you click on the button, the preset is applied to the layer.
But how can I make it so that each button has a unique function because right now everything is getting the same function.
Cheers