Who is afraid of... Shared Actions? Crash course - Lesson 1 (step-by-step)

Preparation

You will create the Slideshow from the Demo project. Please download this Start project (dropbox link) if you want to practice the workflow explained below.

SlideShowStart

Step-by-step

Step 1: explore project

1.1 TImeline and setup

Take a look look at the setup of the second slide. In the Timeline I grouped all design elements at the bottom. 

The 5 items on top of the group are:

  • ImContainer: a multistate object with 5 photos
  • TxContainer: a second multistate object, which has texts in the same sequence to explain the photos
  • SS_counter: smart shape with the text having the embedded variable v_counter
  • SB_Next: the Next button, a shape button
  • SB_Back: the Back button, shape button
  • SVB_Home: SVG used as button

1.2 Variables

Open the Variables dialog box, using Project, Variables.  You will see two variables: v_counter and v_max. The latter will store the amount of items in  your show. Their default values are not important, they will be set with the actions.  Just for clarification I set v_counter to start with 0 and v_max to 5 because the example has 5 photos. But they are not important.

1.3 Library

Open the Library panel, and find the subfolder ‘Shared Actions’. You detect 3 shared actions, and their Usage is stil at 0 for the moment: 

Step 2: ‘EnterSlideShow’ to Slide

Double-check in the Properties panel or on the stage that NO object is selected, that you are in the Slide Properties. 

2.2 Link the action to the On Enter event

There are two possible workflows:

  1. From the Library: drag the name of the shared action to the slide. You just have to be careful not to drag to an interactive object (the three buttons in this slide). It will automatically be linked to the On Enter event, never to the On Exit event. Moreover the Parameters dialog box (see 2.2) opens directly. This is my preferred workflow.
  2. From the Properties: go to the Actions tab, open the dropdown list next to ‘On Enter’, choose ‘Execute Shared Actions’ and choose the action ‘EnterSlideShow’

2.2 Define the Parameter(s)

If you used the Library approach, the dialog box ‘Shared Actions Parameters’ will be open. If you used the Properties  panel approach you need to click the {P} button next to the Action field. In this dialog box you’ll see both description of the action and of the parameters. Please give a value to all the parameters needed. You can use filtering (will post a video tutorial for a more complicated parameters set).

Step 3: actions for the buttons

The Home button has the simple action to return to the first slide. This will allow you to test the reset actions in the On Enter action of step 2. Before testing you still have to attach the shared actions to the two navigation buttons. Workflow is exactly the same for both.

3.1 Link the action to the Success event

You can use again two workflows, similar to step 2:

  1. From the Library: No need to select the button! Drag the name of the shared action to the button.. It will automatically be linked to the Success event of the button.  Of course, this is my preferred workflow, because the Parameters dialog box (3.2) will open immediately.  Saves a lot of clicks.
  2. From the Properties: select the button, go to the Actions tab, open the dropdown list next to ‘On Enter’, choose ‘Execute Shared Actions’ and choose the action ‘EnterSlideShow’

3.2 Define the Parameter(s)

Identical to 2.2. Parameters for both button actions are identical: the two containers. It doesn’t matter if you switch image with text container, sequence is not important.

Step 4: Test

Test and have fun. 

Lesson 2

In the second part of this crash course, you'll learn how to use the same shared actions in your projects. It is not harder than what you have achieved today. Keep on learning...
Prepare a custom project similar to the one you used today:
  • with two slides, start slide only navigates to second slide
  • second slide needs two multistate objects with the same amount of states
  • second slide needs two navigation buttons (back/next) and a home button (jumping to slide 1)



3 responses
Thanks for the step-by-step. Every time I try to do shared actions, it doesn't come out well. I found it faster for me to just retype the actions.
This crash course is not about creating shared actions, but about using shared actions which have been created by an expert. Creating a well-structured shared action which is flexible enough to be used in many circumstances is not that easy. However using them is accessible to everyone, no real expertise needed. For clients I often create shared actions, which allow reusing in many circumstances without having to created scripts or even define variables. That is the real power of shared actions.
1 visitor upvoted this post.