Forums > Javascript

Dynamicly changing arguments for [js]

February 22, 2014 | 3:46 pm

I’m using the example code from the [polybuffer~.maxhelp] file for loading the polybuffer~ using JavaScript in the [js] object. (You can find this example under the "JavaScript" tab in the polybuffer~.maxhelp file.) I need to be able to change the second argument of this [js] file however, the one that sets the target polybuffer~ name. I guess this requires a change to this line of code: var pb = new PolyBuffer(jsarguments[1]);. I don’t really know much about JavaScript though. What change do I need to make in order to dynamically change the [js] argument?



MIB
February 22, 2014 | 4:55 pm

haven’t tested this but should work I think:

function changeArg(a)
{
    pb = new PolyBuffer(a);
}

then use a message box with [changeArg myNewAwesomeArgument] and send it to the js…


February 23, 2014 | 9:23 am

Thanks, MIB. That works great!


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