How do I create an object in a subpatch.
So I have a main patcher (mainpatch), and in it there is a sub patcher (subpatch).
I want to create an object (let's using button for example) inside that subpatch. How do I do that with scripting?
To make an object in the mainpatch I have been using: this.patcher.newdefault(200, 200, "button");
I tried giving the sub patcher a scripting name (subpatchscript) and using:
var sub = this.patcher.getnamed('subpatchscript');
sub.newdefault(200, 200, "button");
but that does not do anything. Any suggestions?
Thank you very much for the help.
[thispatcher] is an object to which you send messages that affect the patcher within which it resides. Look over the [thispatcher] help file for examples of scripting.
This should get you going.
Thank you and this is along the right path but I was looking to do this in Javascript.
In other words, how do I assign a global variable name to a subpatcher object, and then create an object inside that. Here is what I have so far with the code accompanying
var x = 0;
var sub = this.patcher.getnamed('sub');
function bang(){
this.patcher.newdefault(x, 100, "button");
x += 50;
}
function makeinsub(){
sub.newdefault(100, 100, "button"); //This does not work
}
//sub.subpatcher.newdefault(100,100,'button'); //neither does this
Doh! Of course. Well.. can't help you there but I can bump the thread. :)
You can do something like this:
sub.subpatcher().newdefault(100, 100, "button")
THANK YOU!
sub.subpatcher().newdefault(100, 100, "button")
THANK YOU!