Animating Shapes in PowerPoint 2000 and 97 (Part 4 of 4)
(Previous entries in this series: part one, part two, and part three.)
Creating Animation Effects for Media and OLE Objects
For audio and video files inserted as media objects, not only can you set the shape’s animation effect, as with other shapes, but you can customize how the file plays as part of its animation effect as well. The PlaySettings object contains properties that enable you to customize how sound and movies play when they are animated. Table 1 lists these properties, and what you use each for.
Table 1. Selected PlaySettings object properties.
PlaySettings property |
Definition |
HideWhileNotPlaying |
Set whether to display the media object when it is not playing. |
LoopUntilStopped |
Set the file to play continuously until it’s stopped by the user clicking it, or the next slide transition. |
PauseAnimation |
Set whether the animation sequence for the slide is paused until the file completes playing. |
PlayOnEntry |
Set whether the file plays when the file’s entry effect occurs as part of the slide’s animation sequence. |
RewindMovie |
For video files, set whether the first frame of the movie is automatically redisplayed as soon as the movie has finished playing. |
StopAfterSlides |
Set the file to stop playing after a specified number of slides have been displayed or when the media clip comes to an end, whichever happens first. |
You can also specify that an OLE object perform one of its verbs as part of its animation effect. Use the ActionVerb property to specify which of its verbs the OLE object performs.
Each Shape that represents an OLE object contains a OLEFormat object. The actions an OLE object can perform are contained in the ObjectVerbs collection, which is a child of the OLEFormat object. For example, the following code returns the verbs available for the specified OLE object:
Dim intCount As Integer
With ActivePresentation.Slides(5).Shapes("AVI File") _
.OLEFormat.ObjectVerbs
For intCount = 1 To .Count
Debug.Print intCount & " " & .Item(intCount)
Next
End With
Note that if you insert an audio or video file as an OLE object, rather than as a media object, you cannot set PlaySettings properties for that shape that apply to media objects.
To determine if a given shape is a media or OLE object, use the Type property of the Shape object. This property returns an MsoShapeType constant, such as MsoEmbeddedOLEObject, or MsoLinkedOLEObject or MsoMedia.
For more information on adding media and OLE objects to your presentations programmatically, see Adding Multimedia to a PowerPoint 2003 Presentation.
Object Model Maps
The following diagrams detail the structure of the AnimationSettings object model section.
Figure 1. The AnimationSettings Object
Figure 2. The PlaySettings and SoundEffect Objects
So there you go. As you might have guessed, about half way through writing these entries, I realized I had a full-blown article on my hands. So I’ll probably roll these entries together, clean ‘em up, and submit them as a single article for the Office Developer Center. But it may be awhile until the finished, polished article appears on MSDN, so in the meantime, here’s the information in draft form.