In the last post we learned about the Captivate Movie’s head honcho: The Captivate Main Timeline. Now it’s time to climb a little further down the family tree and meet the old man’s kids.
Ladies and Gentlemen, I give you: Slides.
What are Slides?
As users of Captivate, we think of slides as chapters in a book, each dealing with a specific topic. While that is true from a metaphorical point of view, from a technical point of view, a slide is a Display Object (Display Objects were explained in the previous post). The slide Display Object is a child to the Captivate Main Timeline.
When the Captivate Main Timeline realizes the movie needs to move to another slide, it sets that slide appear, then tells the previous slide to disappear. So the Captivate Main Timeline controls which slide will be shown next. Whereas, slides control when their objects (Such as Captions, Highlight Boxes, Images…) will appear.
I find it helpful if you can think of the Captivate Movie like this:
A Show to End All Shows!
Slides are the Captivate Main Timeline’s sons and they’re in the film business.
All of them.
And yes, in case you were wondering, they are all identical… er… Quadruplets.
What’s more, each of them are Dads too, and their kids are a real handful. Yep, they’ve got little Captions and Highlight Boxes running about at home.
The story goes that the Captivate Family are having a big reunion hosted at Grampa Timeline’s house. As part of the festivities, the grand-kids are to take part in one big talent show! However, each slide is assigned one act for all his kids to take part in. So it’s up to Daddy slide to coordinate the family act. Yes he’s the one that has to make sure little Clarance the Caption can sing her song, while Herbie the Highlight Box can dance to it.
So although the slides never appear in the act (even the slide background is a separate Display Object that the slide has hired out) they are the managing force behind it.
And that’s basically what the whole Captivate Movie is.
Getting a Hold of a Slide
So slides have an important place in the Captivate family. So how might we, when coding a widget, get a hold of a particular slide?
WidgetFactory has many tools for accessing slides.
The slide you’ll most commonly want to access is the slide the widget has been placed on. This can be accessed directly through the widgetSlide property.
However, if your widget is doing some behind the scenes calculations while its slide is not active, you can access the slide that is active through the currentSlide property.
But what if you just want to access the first slide, or a slide with a particular label, or you need to loop through the slides until you find a specific one, like the Quiz Results slide? In that case, you can use the getSlide() method. Just pass in the number, or label (though this will only work if the movie has Accessibility turned on), of the slide into the function, and it will return a reference to it. For Example: The next line of code will return you a reference to the first slide of the movie.
To store that slide reference in a variable, you’d write it like this:
So now that we know how to get a hold of our desired slide, what can we do with it?
Slides have a number of objects and methods that widget developers will find useful. There are a few properties…
- m_paused (Boolean): Indicates whether the slide is paused or not.
- m_projectSlideIndex (int): Holds the slide’s number (this value is zero based, so the first slide would be 0, the second would be 1, and so on)
- m_movie: A very interesting object that is essentially a remote control for the whole movie. I’ll be writing more about this in a future post.
…But methods are really where it’s at for slides. Here are some of the handy ones:
- getSlideProperties() : Returns an object that has the following properties.
- startFrame (int): The frame of the movie that this slide starts on.
- endFrame (int): The frame of the movie that this slide ends on.
- slideTyle (String): A string that describes what sort of slide this is.
- slideHandle: A proxy object of the slide.
- getSlideDatabaseId() : Returns a number which… is some sort of database ID.
- hasSlideAudio() : Returns a Boolean which indicates whether this slide has audio.
- isSlideActive() : Returns a Boolean which indicates whether this slide is currently being viewed or not.
- isSlidelet() : Returns a Boolean which indicates whether this slide is actually a slidelet.
- nextSlide() : Jumps the movie to the next slide.
- previousSlide() : Jumps the movie to the previous slide.
- resumeSlide() : If the slide has been paused, this starts it playing again.
It’s a Slippery World Out There
Today we’ve learnt a lot about the common slide. However there are many varieties of slides, like: Quiz slides, Animation Slides, Image Slides, PowerPoint Slides, Recording Slides, and Master Slides. In the future, we may take a more in depth look at what makes these slides unique, and how you can use them to your advantage.