g = new Global(name)
name represents a String that uniquely identifies the Global.
g = new Global("name") g.bob = 12 h = new Global("name") post(h.bob) // will print 12
There are no fixed properties for a Global object. Instead, you assign properties to a Global object (described above) so that they can be accessed by multiple js object instances.
property name [string]
Sends the value of the named property property_name to the named Max receive object (or other Max object) bound to the specified receive_name symbol.
g = new Global("xyz") g.ethyl = 1000 g.sendnamed("fred", "ethyl")
Any receive objects named fred will send out their outlets.
Accessing the Global Object from Max
To use Max to send a message to a named object, type a semicolon followed by the name of the receiver and the message you want to send into a message box. To set a property of a js Global object, send the property name followed by one or more values (multiple values set the value of the property to an array). Assuming you have already created a Global xyz object...
This sets the value of the george property to 30.
; xyz george 30
This sets the value of the frank property to an array of three strings containing "x" "y" and "z"
; xyz frank x y z
You can also use the message sendnamed from Max to output property values to named receive objects. This sends the current value of the frank property in the js Global object xyz to any receive objects named hubert.
; xyz sendnamed hubert frank