Adobe ATMOSPHERE User Manual page 285

Table of Contents

Advertisement

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
buttonMiddleDown
buttonRightDown
clickDown
clickEvent
clickUp
metaKey1Down
metaKey2Down
metaKey3Down
metaKey4Down
x
y
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);
// true or false state of the left mouse button
// true or false state of the middle mouse button
// (currently always false)
// true for mouse down event, and false for mouse up
// acts as a 'type' identifi er, and returns true for all click events
// true for mouse up event, and false for mouse down
// true if 'Shift' key was also held down during click event
// true if 'Ctrl' key was also held down during click event
// (currently not used)
// (currently not used)
// the x-axis pixel position of the mouse during the click event
// the y-axis pixel position of the mouse during the click event
273
ADOBE ATMOSPHERE
User Guide

Advertisement

Table of Contents
loading

Table of Contents