Adobe ATMOSPHERE User Manual page 325

Table of Contents

Advertisement

Within this top section, the script writer uses the "defi neCustomPropertyValue" method shown below to create
properties (variables and functions) which can be seen by the user in the Inspector Palette. During use of the
Authoring Application, the default values for these properties can be modifi ed by the user. Also during Application
use, functions (called 'actions') can be linked to other objects or script properties. This allows the output of a function
from one script (for example, 'onClick') to trigger the function from another script (such as 'playSound').
The user modifi ed values are stored in both the ".atmo" project fi le and the ".aer" published fi le (which is used for
viewing in the webpage).
When the ".aer" published fi le is opened in the Atmosphere Player, the rest of the script is read and processed (again,
the top section is ignored). In this bottom section, the script designer retrieves the custom user values using the "get
CustomPropertyValue(name)" methods shown below. The script designer then performs the script driven tasks and
activity using the custom values retrieved.
Final comments:
• If default values are specifi ed when the properties are created in the top section of the script, these default
values will be saved even if the user doesn't modify them. In this manner it may possible for the script to
accomplish much with very little input from the user.
• It's wise to use the keyword 'this' when retrieving the custom property values. If you tie all the properties to
the 'this' object, then variable names from one script will not collide with another script in the world.
(example: this.target = this.getCustomPropertyValue("target"); )
• Lastly, it's useful to put instructions for how to use your script into comment lines at the top of the script.
Once a user loads your script into the world, the instructions can be viewed by simply clicking the 'Edit'
button on the Inspector palette when your script is selected.
The Atmosphere development team recommends designating your instruction section with the lines "//BEGIN_
INSTRUCTIONS" and "//END_INSTRUCTIONS". This will aid the casual user of the script in knowing where the
instructions are defi ned, but Atmosphere may also add functionality in the future to show these instructions in a
different manner, making it easier to reference your guidelines as they work with the script during world design.
Local Properties
type
The object's type; returns "Script".
if (myObject.type == 'Script') { ... }
name
Returns the name of the object as assigned in the Application.
if (myObject.name == 'myCoolObject') { ... }
loaded
Returns true once the object has fi nished loading.
if (myObject.loaded) { ... }
313
ADOBE ATMOSPHERE
User Guide

Advertisement

Table of Contents
loading

Table of Contents