Make a Dynamic Counter for a Slideshow
From KickApps API Reference
In the 4.0 Release Note I mentioned that you can build a dynamic counter for a slideshow by populating text components with values from the slideshow. Getting this right is trickier than it sounds, but with a few clicks and some clever JavaScript (thanks Derek!), you too can share in the glory that is the dynamic counter.
Follow these steps to create a slideshow with a dynamic counter indicating the number of the current item in your slideshow over the total number of items. You can use the same technique to make dynamic counters for video players, audio players, and 3d galleries.
- Drag a slideshow component to the stage, add a feed to it in its Content panel
- Drag two text components to the stage. The first will show the number of the current item, and the second will show "/" and the total number of items in your slideshow.
- Select the slideshow component and open the Actions panel.
- Add a new Action. This action should be triggered by the Media Change event and invoke the Update Property action to change the "Text" property of your first text component to
javascript:eval(1 + #{Slide Show Component 1.selectedIndex}) - Add another Action to the slideshow. Again use the Media Change event to invoke the Update Property action, but this time change the "Text" property of your second text component to
/ #{Slide Show Component 1.dataProvider.length}Note the spaces before and after the "/".
Oila!