Max supports the use of the JavaScript language within Max patches (via the js object) to enable more flexible and powerful funcionality than is possible with existing Max objects, including the ability to design dynamic patch or GUI elements.
This example also demonstrates how object arguments are handled.
The functionality of the jstest1 patch could be easily achieved using the Max scale or expr objects. However, something that would not be so easily handled by normal Max objects would be the use of the lastIn and/or lastOut variables in the scaling computation.
Tutorial #1 introduces basic JavaScripting and highlights the ability to easily perform computations that make use of stored internal variables.
Tutorial #2 demonstrates the ability to dynamically create and inter-connect Max objects in a patch. It also shows how to use methods to handle custom messages coming from the patcher.
Tutorial #3 details the use of JavaScript functions that use the Max scheduler, as well as introduces Global objects that allow data to be shared between internal js data structures and Max.
Tutorial #4 focuses on the use of the jsui object, which allows for the design of graphical user interface objects, with support for two- and three-dimensional vector graphics drawn with OpenGL commands, as well as support to handle mouse interactions in the jsui object window.