Understanding interactors
You have seen that you can alter the appearance of symbols by using parameters and conditions. This ability is useful for creating rich graphic objects such as dials or meters, for monitoring activities.You can also make GUI objects respond to user actions by using interactors. You use an interactor to create interactive objects by specifying how user actions can alter the value of a symbol parameter.
This mechanism works as a loop. A user interaction modifies the value of a parameter, this new value is processed by the symbol in order to give the appropriate visual feedback. Both actions in this loop are completely independent, that is, the interaction does not need to 'know' what the visual effect is.
The interactor workflow
A symbol interactor detects and processes input done by the user on a symbol. This input is in the form of mouse events on the graphical representation of a symbol.
An interactor does one of two things:
Uses the mouse event to change the value of a parameter in the symbol. Objects bound to the parameter are transformed according to this change in value.
Passes the event to the object as a condition. This is used for Push and Discrete interactors.
The different kinds of interactions available are as follows:
Discrete: Increments or decrements the value of a parameter by a specific amount on a mouse click event. Parameter change is limited by maximum and minimum values.
Push: Reacts to mouse BUTTON_UP, BUTTON_DOWN, and BUTTON_CLICKED events on a symbol. It sets the value of a string parameter in order to indicate the new state that the symbol could display.
Horizontal: Changes the value of a parameter when an object is clicked and dragged horizontally. The change in parameter value depends on the distance the object is dragged. Parameter change is limited by maximum and minimum values.
Vertical: Changes the value of a parameter when an object is clicked and dragged vertically. The change in parameter value depends on the distance the object is dragged. Parameter change is limited by maximum and minimum values.
Rotation: Changes the value of a parameter when an object is clicked and rotated. The change in parameter value depends on the distance the object is dragged. Parameter change is limited by maximum and minimum values.
Discrete, Horizontal, Vertical, and Rotation interactors work in the same way. They respond to a mouse event by changing the value of a symbol parameter. This means that, although the interactor is applied to a specific object, the change occurs to any object bound to the parameter. Push interactors use conditions to transform the object clicked. When a condition has been created for a push interactor, it can be used to make simultaneous changes in multiple objects.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.