User Guide
ADOBE ATMOSPHERE 273
User Guide
myEventHandler.onEvent = function(mouseEvent, what)
{
chat.print(“Object = “ + what);
dump(mouseEvent);
}
If the above onEvent function is called as shown, a ‘dump’ of the mouseEvent will return the following
properties, which can in turn be used to control other logic for the event:
buttonLeftDown // true or false state of the left mouse button
buttonMiddleDown // true or false state of the middle mouse button
buttonRightDown // (currently always false)
clickDown // true for mouse down event, and false for mouse up
clickEvent // acts as a ‘type’ identifi er, and returns true for all click events
clickUp // true for mouse up event, and false for mouse down
metaKey1Down // true if ‘Shift’ key was also held down during click event
metaKey2Down // true if ‘Ctrl’ key was also held down during click event
metaKey3Down // (currently not used)
metaKey4Down // (currently not used)
x // the x-axis pixel position of the mouse during the click event
y // the y-axis pixel position of the mouse during the click event
Local Methods
By default, a MouseEventHandler responds to all mouse events. While this seems advantageous initially, all
mouse ‘move’ events are processed and can quickly become cumbersome. Filtering Methods are therefore
provided below to limit the scope of mouse events and allow customized responses.
The methods require that an object be specifi ed, and this object will be used to determine if the OnEvent()
callback should be triggered. Shown here is a list of object types and their scope during mouse event processing:
All world geometry will respond to mouse events. Primitives should be named in the Builder application so that
customized responses can be created.
The stageModel represents the parent geometry in the world, and will respond to all mouse events if it specifi ed
as the fi lter object. Note that the ‘sky’ does not respond to mouse events when the stageModel is used as the
object.
Any portion of a loaded SceneGroup will respond to mouse events, if the top level SceneGroup is referenced as
the fi lter object. The scope can be reduced further by naming primitives in the loaded SceneGroup.
Viewpoint objects which are imported into the stage or which are loaded as part of a submodel will respond to
mouse events. The entire Viewpoint object is used, and cannot be limited to specifi c instance components.
setFilterOnClick(object)
Causes the specifi ed object (Primitive, Viewpoint Object, or SceneGroup) to return an ‘OnClick’ mouse event.
chair = theStage.getPrimitive(“chair”);
myEventHandler.setFilterOnClick(chair);










