Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Using the Flash CS5 cue point system, you can add ActionScript cue points to your FLV files. Remember, as we looked at earlier, when you select an FLV file, you can add cue points through the Properties panel. Remember that each cue point has a parameter called caption with a value that we're going to place inside of that text field. Let's go to the first keyframe of the actions layer and open up the Actions panel. At the bottom of all lines of code that say addEventListener, I'm going to add a new line and a new EventListener.
We'll add the EventListener to the FLVPlayback component. So flv_mc.addEventListener() and a semicolon. Now the event that we're going to listen for is the MetadataEvent.CUE_POINT event. Now you'll just have to remember this, because even though ActionScript cue points are embedded into a video's metadata, you are still going to treat them as if they are metadata in the code.
So Metadata, only a capital M, Event with a capital E, should turn blue .CUE_POINT all caps, and then a comma and a space. We'll run a function called cuePointReached. So above the toggleCaptions function, I'm going to define the cuePointReached function. Make sure it receives an event with a datatype of MetadataEvent :void, no return data, then some curly braces.
Now we are going to set the text of the text field inside of captions_mc. So it's captions_mc.caption_txt - that's a text field inside of the movie clip - .txt = evt.info. Notice in the code hinting area, info property is an object. That gives us the metadata. Inside of the metadata, there is another property called parameters.
So type .parameters. The code hinting looks a little bit weird right here, because the code hinting for the Object datatype is just these few things, because the Object datatype can hold any number of parameters that you can create whenever you want. So you can't get code hinting for the Object datatype. So after parameters, then we type the name of the parameter that we want to access, which is caption. So we type .caption. Type a semicolon. Now you should be able to test the movie, click the Play button, and watch the captions appear.
(Music playing.) Of course, if you want to, you can click the i button and show and hide the captions. If you continue on, everything will still work properly. (Music playing.) So once you've set up your cue points, you can use them for just about anything you want, including closed captions.
To use them, you listen for the MetadataEvent.CUE_POINT event. You can access the data through the info property. You can access the parameters through that object's parameters property.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101962 Viewers
61 Video lessons · 88680 Viewers
71 Video lessons · 72487 Viewers
56 Video lessons · 104170 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.