Using Variables in Captivate 4: A Simple Page Counter
Posted on 07. Oct, 2009 by captivatehero in Captivate 4, Tutorials
Hello fellow Captivaters!
This week I’m going to create a simple page counter using Captivate 4 variables that will keep track of the current slide that you are on and the total number of slides in your presentation. (Example: Slide 3 of 20) This is a straightforward way of letting your audience members track their progress, and is especially helpful is you decide to ditch Captivate’s Skin for your own custom navigation controls.
In prior versions of Captivate I created a Flash movie that would grab the existing slide variables with ActionScript 2.0 code and display them in an imported SWF. This was always a big hit in Captivate classes, but anyone who was not inclined to program was a little put off. Well no worries about code anymore. All you will need to pull this off is just a Text Caption and few clicks. Let’s get Captivating!
- On the Captivate opening screen under the Create Project column select Blank Project.

Select Blank Project.
- The New Project dialog box appears. From the drop down list on the right choose 790 x 545 Browser.

Choose 790 x 545 in the New Project dialog box.
- Click the OK button.
- A new untitled CP file is created. Save your work as SlideCounter.cp
- Add three blank slides by selecting Insert > Blank Slide three times. This will take you to the Edit View automatically.

Create three Blank Slides.
- Select Slide 1 in your Filmstrip.
- Choose Insert > Standard Objects > Text Caption…

Insert a Text Caption.
- The New Text Caption dialog box appears.
- Set up some simple Text Caption Properties
- Caption type: [transparent]
- Font: Arial
- Size: 14
- Type the word “Slide” in the Caption editor.

Select the Insert Variable button.
- Click on the Insert Variable button. The insert variable dialog box appears.
- Select System for the variable type.
- View by Movie Information.
- From the Variable list choose cpInfoCurrentSlide.

Select the cpInfoCurrentSlide variable.
- Click the OK button.
- Type in the word “of” right after the inserted variable.

This is what your text should look like.
- Click on the Insert Variable button again. The insert variable dialog box appears.
- Select System for the variable type.
- View by Movie Information.
- From the Variable list choose rdInfoSlideCount. You now have the variable in place. When these variables render they will display “Slide 1 of 4”. The first variable will resolve the current slide that you are on and the second will keep track of the total number of slides.

Select the rdInfoSlideCount variable.
- Click the OK button in the Insert Variable dialog box to close out.

Text Caption with variables added.
- Now it’s time to set up an object attribute to make sure that we can see our Simple Page Counter on all slides.
- With the New Text Caption dialog box still open click the Options Tab.
- In the Timing section – change the Display for: value to Rest of Project. This will allow the Page Counter to be visible on all slides.

Display the Text Caption for "Rest of Project".
- Click the OK button.
- Preview your example by hitting the F4 key.
You should now see your page counter read 1 of 3, 2 of 3, and 3 of 3 as it progresses through the slides.

This is the final variable text rendered in the caption.
If you see these results – well done!
Sample File (520K)
Now that’s real Captivate variable power.





















Elissa
08. Oct, 2009
I am workingn on a Captivate 4 project that has image buttons for previous (on success: go to previous slide and next slides (on success: go to next slide).
When I add these system variables for page counting and preview and/or publish the project, the system variable itself ($$cpInfoCurrentSlide$$ of $$rdinfoSlideCount$$) is visible when the previous or next button is clicked.
When I replace the buttons with the widget for the perpetual button, the problem resolves. However, our corporate template uses the previous and next buttons.
Any thoughts?
captivatehero
08. Oct, 2009
Elissa-
As long as you put these variables inside of a text caption they should resolve and a number should display. There is no relationship between how a user navigates between slides and the function of the these variables in Captivate. Very strange indeed.
You can e-mail me at hero@captaincaptivate.com if you are still having problems.
The Captain
Nick
26. Oct, 2009
I am having the same issue as Elissa above. When using the variable the code will briefly flash when clicking on the previous or next button that has been inserted onto the slide. When the buttons are removed however the page numbers transition perfectly, its only when the inserted buttons are on the page that this occurs. Like Elissa my company uses the Previous and Next buttons in this current project and removing them isnt an option. These variables are all inserted within a text caption and yet the problem still persists.
Any addtional thoughts on this subject? Thanks!
captivatehero
29. Oct, 2009
Nick-
I have seen this problem too. I think there’s a slight delay with the variable rendering on the slide.
It should be quick, but it’s not.
You could try turning the transition off of the object. Also, display it for rest of project.
I think that this is just a deficiency with Captivate and hopefully they fix it in the next version.
The Captain
Priti
01. Feb, 2010
Hi,
I am an under trainee for Captivate 4. I along with other batchmates tried the steps you listed. It worked perfectly. Thanks for the help in creating page counter. I look forward to more information and will keep you posted with our updates.
Regards,
Priti
soma uk
02. Mar, 2010
hi, spring is cooming! good post there, tnx for captaincaptivate.com
Cathy
04. Mar, 2010
I’m working on a Captivate 4 project and fairly new at adding system playbar variables. Do you have any tutorials on that? Or, can you talk thru an example?
captivatehero
11. Mar, 2010
Soma-
You are very welcome. I appreciate the comments.
The Captain
captivatehero
11. Mar, 2010
Cathy-
Do you just want to hide the playback bar? What specific forms of functionality are you trying to achieve?
I think I may need just a little but more info.
The Captian
Ray
16. Mar, 2010
Elissa
Try selecting the text of your variables and changing the font color to match you background but not “Slide Of ”
that my help
Robert Nicholas
29. Apr, 2010
This is a great article.
I just received Captivate 4 at work..I’m REALLY loving it. I tried learning basic actionscripting in Flash, and really didn’t get it. I am hoping that I can learn it in Captivate a bit easier.
In my current lesson, I have it broken up into 6 sections, but all in 1 .swf (I’m lazy…). When I designed the lesson, I actually was using Captivate 3, thus didn’t know that these types of variable features would be available.
Anyway, the lesson is broken up as so:
Title Page - Page 1
Course Map - Page 2
Section 1 - Slides Page 3-7
Section 2 - Slides 8-15
Section 3 - Slides 16-25
…etc.
After each section, it goes back to the “course map”.
So, when the user is on page 3 (beginning of section 1) I’d like it to say Page “1 of 5″. When he’s on page 4 (second page of section 1) I’d like it to say “Page 2 of 5″ …etc. When the user is on slide 8 (beginning of section 2), i’d like it to say “Page 1 of 8:,,etc…essentially, have the page breakdown be a bit more custom than just having the variable look at the whole project.
It seems to me that there SHOULD be a way to do this, but my pea sized brain is not registering how.
Ideas?
Robert Nicholas
13. May, 2010
I guess no ideas.
I played around with it more, and still cannot figure it out.
Larena Jackson
17. May, 2010
Elissa and Nick,
I had the same problem seeing the code for a split second before it appeared.
I changed the Published Settings under Preferences to AS3 and no longer see the split second of code.
Not sure if you can use AS3 instead of AS2 where you work but worth a try.
Patricia
18. May, 2010
THANK YOU THANK YOU THANK YOU!!!
I actually didn’t need to make the slide counter, but your instructions helped me figure out how to make a “spending tracker” for a simulation I’m doing. The user starts with a certain budget and can spend it (or not) by taking certain actions. I used your instructions to display the “remaining funds” as the user proceeds. Funny how a simple subtraction could thwart me as soon as the software isn’t familiar territory.
I don’t know if anybody else has similar needs but the “cash register” might be a good idea for one of your how-to posts. Thanks again!
captivatehero
26. May, 2010
Robert-
You will need to use custom variables in this situation that maintain the numbering of each section.
That’s the only way I can see handling this in Captivate 4.
- The Captain
Ellie
07. Jun, 2010
I am trying to have the progress bar show a percentage of completion. Can you help me with the variables?
captivatehero
07. Jun, 2010
Ellie-
You could write an Advanced action that performs a calculation on the total number of slides and your current slide.
1. Create a new User variable called percentageComplete and set it to 0
2. Write and Advanced Action the divides cpInfoCurrentSlide and rdInfoTotalSlides and set it to the value of percentageComplete.
3. Display the percentageComplete variable in the text caption with the following code:
$$percentageComplete$$%
4. You will need to run the Advanced Action on each slide to get this to update. Also, any branching will cause this to act inconsistent.
I hope this helps.
- The Captain