Set attributes of objects created by Javascript
Hi!
This is probably a dumb question, but I could not find the answer (may have not been searching properly): Is there a way to set the attributes of an object that I have created using newdefault or newobject? I know I can do something like this "patcher.newdefault(100, 100, "pattr", "@initial", 1);", but I'd rather not have all the attributes in the created object's rectangle clutter up the patcher. Is there something like an setAttribute method for objects? Is there a comprehensive reference documentation for the possibilities of the [js] object somewhere? Thanks everyone!
Thomas
from javascript you can:
var p = patcher.newdefault(100, 100, "pattr");
p.initial(2);
p.dirty(1);
Thanks very much, raja, your suggestion solved my problem. It works like this:
var p = patcher.newdefault(260, 70, "pattr");
p.message("parameter_enable", 1);
Your code snippet, artm, does not work for me, however, but that's no problem. I prefer the way of writing things like above anyway.
strange. i tried
var p = patcher.newdefault(100, 100, "pattr");
p.parameter_enable(2);
and it worked. had to delete the old pattr though, to avoid confusion :-)
Oh, I just noticed both approaches work, but somehow only the non hidden attributes show the values set by either method in the inspector (e.g. parameter_enable is ticked in the inspector, but initial or initial_enable looks unchanged, but the behaviour is as expected). Strange ...