Adobe ATMOSPHERE User Manual page 264

Table of Contents

Advertisement

252
APPENDIX E
Global Methods
Button(label)
creates a Button with the specifi ed label (optional). The Button will not be added to the Control Panel until you
call add().
takePicture = Button("Say Cheese");
Toggle(label)
creates a Toggle with the specifi ed label (optional). The Toggle will not be added to the Control Panel until you
call add().
fogToggle = Toggle("Fog Enabled");
Properties
state
true if the button or toggle is down/checked, false if it is up/unchecked.
// Init the toggle to refl ect the current fog state.
fogToggle.state = fog.active;
enabled
If false, the button or toggle will not respond to clicks.
// Don't let the user change the fog right now.
fogToggle.enabled = false;
label
the button or toggle's current label
button.label = "Try Again!";
Methods
add()
adds the button or toggle to the control panel associated with the current world. The toggle itself is returned as a
convenience.
fogToggle = Toggle("Fog Enabled").add();
remove()
removes the button or toggle from whatever control panel it is currently in.
fogToggle.remove();
Callbacks
onClick(state)
is called when the button is pressed or when the toggle state changes (either due to the user clicking on it, or if
toggle.state is changed by JavaScript code).

Advertisement

Table of Contents
loading

Table of Contents