Viewers: in countries Watching now:
In ActionScript 3.0 in Flash Professional CS5 Essential Training, Todd Perkins shows Flash designers how to incorporate ActionScript code into their projects and create interactive presentations and applications. The course includes a review of ActionScript language basics and the object-oriented programming (OOP) methodology, a tour of those Flash Professional CS5 features designed for developers, such as code hinting and the Code Snippets panel, and instructions on interacting with objects in the Library and placing code on the Timeline. Exercise files are included with the course.
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.
Find answers to the most frequently asked questions about ActionScript 3.0 in Flash Professional CS5 Essential Training .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
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.