Forums > Javascript

What is scripting name/var name for?

December 30, 2013 | 1:56 am

Can anyone explain to me how I should/can use the "scripting name" attribute in javascript?
In the inspector I can see it is the same thing as the "varname" property, but I am not sure exactly what this helps me do.

It seems like this could somehow be used to access the various objects in the patcher but I have tried var x=this.patcher.getnamed("setvarname");
function bang(){
x.outlet(0,"hello");

And that-and any variations, do not work. Thanks for any input.


December 30, 2013 | 2:56 am

Hi !
varname is a scripting name for your JS api , so you can find it inside your patcher easily through JS
for example this way :

var myObject = this.patcher.getnamed("yourScriptingName"); // lets say numbox has varname of "yourScriptingName"

function bang(){
    myObject.message("int",9);
//or
    myObject.int(9);
}

Viewing 2 posts - 1 through 2 (of 2 total)