onclick.local, ondrag.local, onresize.local: what are they for ?

    Mar 26 2014 | 11:06 am
    In the jsui help patch, there's the 2d vector control example.
    One can see lines of code using the onresize.local, onclick.local and ondrag.local variables.
    First I do not understand when those lines are executed because they are outside any function (see shortened code below).
    Second, what are they for ?
    Thank you in advance.
    Roald Baudoux
    function onresize(w,h) { ... } onresize.local = 1; //private
    function onclick(x,y) { ... } onclick.local = 1; //private
    function ondrag(x,y) { ... } ondrag.local = 1; //private

    • Mar 26 2014 | 12:21 pm
      Salut Roald,
      setting the local property of a function to 1 will make it inacessible from outside the js instance, i.e. from Max patches.
      In your example, you cannot send the message onclick(66,666) to the js.
      Setting values don't need to be done within a function, I'm sure you do things like: inlets = 1; in your codes.
    • Mar 26 2014 | 12:25 pm
      OK, the answer is in "Max JS Tutorial 4: Designing User Interfaces in JavaScript".
    • Mar 26 2014 | 12:52 pm
      Salut Patrick,
      I discovered your answer after having posted mine !
      Sure code can be put outside functions but it's a bit strange to see it there...