Help Topics Version 2.0

Using Actions

Touch Creator allows you to determine which actions are triggered on components during the runtime of a multi-touch scenario. This is achieved by Actions that convey interaction from the touches of the user to any parts of the scenario.

Various types of actions are available. For instance, pressing a button may start a video, touching one component may cause another to disappear, or pressing a button may reset the overall scene to its initial state. With special actions you may even allow users to control external devices.

Creating an Action

Select the component that is to trigger the action. Go to the Actions tab in Inspector and click the button below the Actions list. Then select the action from the pop-up menu that you would like to use.

Not all actions are applicable to all components, for instance the Toggle Visible action makes no sense for components that have no visual representation in a scene, e.g. Timer components or Network Sender components.

All actions have the same general settings. They are as follows:

The way an action is displayed in the list will help you recognize its function. Here's an example:

In this example, the event to trigger the action is Clicked. The action to be carried out is Hide and the receiver is Media Player 2. The actions you see in this list are assigned to the component currently selected in the Scene Manager.

Events

There are several events that can be set to trigger an action. You will use some of them frequently, for instance Clicked, while others may be used rarely, for instance Network Message. The following events are available.

Note: Some of the touch events above overlap to a degree. For instance, any Pressed, Pressed Long, and Double Clicked event includes a Clicked event. Also, with a Pressed Long event a Pressed event is always triggered.

Using Actions

Each component may be assigned multiple actions. This way, you can implement components that affect the multi-touch scenario beyond their basic functionality. For instance, you can assign a Style action to a Media Player component changing the component's size on a touch event.

Actions are one-time changes. This means that once you have triggered an action, such as hiding a component or changing its style, the result of that action will remain until the component is acted upon again. So the component will stay hidden or retain its new style. Because of this, it may be important to give users a way to reverse actions if required in your multi-touch scenario.

Since components often have several actions assigned to them that may have various effects, you might want to take full advantage of the Stage while composing your scenario's interaction. Since the Stage offers a live preview of the multi-touch scenario, you can test your actions immediately and then reset them. This will ensure that the desired interaction will be attained.

Sequence of Actions

You can create multiple actions assigned to an individual component. The sequence in which you create these actions has no effect on the sequence they are executed. However, two actions A and B may run in different order at different times, which may lead to different results if the same properties are changed.

Imagine action A resizing a component C in total pixels (e.g. X=500 px, Y=500), while action B scales the same component C by percentage (e.g. 50%). The sequence A→B leads to X=250 px, Y=250 px, while B→A leads to X=500 px, Y=500 px, i.e. action B is practically ignored.

This is why we don't recommend assigning multiple actions to a component affecting the same property of another component. If you require a sequence of changes to the same property of a component, you may create a chain of events that trigger the individual changes, for instance by means of Timer Fired events. Also, the use of a script is a viable option.

Related Topics

© ~sedna gmbh 2016