Join Paul Trani for an in-depth discussion in this video Syncing graphics with video, part of Creating a First Web Site with Flash Professional CS5.
- View Offline
One of the great things about using video in Flash is that you can sync up the video with other graphics on the site, and that's what I want to do here with this video. When Jill says certain things, I actually want to highlight some text in these paragraphs. So, I'm going to double- click on this movie clip. It's right in here, and that's where my video lives, but what I want to do is I'm going to add a new layer, and I'm going to just call it highlights.
These are the highlights that I'm going to draw. So, I'm just going to use the Rectangle tool and I'm just going to go ahead and select red as my fill color and make it about 50%, and I'm just going to draw a quick box right here because when Jill says Rhode Island School of Design, I want to emphasize this information. So, let me select that graphic here, and let me just change the color and make sure that's at a bright red, and that looks pretty good, nudge it into place, and I'm going to go ahead and drag it to the Library, and I'm going to call this-- first off, it's not going to be a button.
It's going to be a movie clip, but I'm going to call this highlight1. There we are. There's my highlight1. I'm going to go ahead and draw another highlight over here that highlights the places that she's worked at, like that, all right. So, I'll select these rectangles, drag them to the Library, and I'll call them highlight2, just like that. Now, I need to give each a specific instance name.
So, the first one is going to be called highlight1, second one highlight2, like that. All right, so far, so good. There's my highlights in place. Now, I need to determine when Jill says certain items. So, I'm going to lock down some of those graphics, so I can select that video, and I'm going to open up this Properties panel and if I close up those parameters, notice that I'm given Cue Points right in here for this video.
Okay, so, the first thing I'm going to do is I'm going to give this video an instance name of jillvideo. It's the name of the video and on this video it's going to have a couple cue points, and I'm going to determine those by hitting this plus sign. So, I'm going to play this video, and I'm going to hit the plus sign to add various cue points, so. (Female speaker: Hi, my name is Jill Steinman. I'm a freelance graphic designer working in New York City.) (Female Speaker: After graduating from Rhode Island School of Design, I immediately started working for various high-profile ad agencies.) (Female Speaker: After five years, I made the move to freelancing full-time, mainly because I feel that design?) All right, so, here's my three cue points.
The first one is going to be my first highlight, which is about her schooling. So, I'll just go ahead and say highlight1, because that's what I want to highlight, second cue point is highlight2, and this third one I made is the one where I just want to make both highlights go away. So, I'll just type in end there. So, I've determined my cue points. I have my graphics in place. I know the name of this video.
Now I can add some ActionScript, and I'm going to use the Code Snippets panel to do this. I am going to go to Window, down to Code Snippets, and I'm going to open up this Audio and Video folder, and this third one down is the one I'm going to select, because On Cue Point Event, I want certain things to happen. So, I'll just double-click there and it adds that code. So, it's referencing the video because I had it selected and it's going to trace out the name of the cue point.
So, this is either going to be highlight1, highlight2 or end. So, what I want to do instead of tracing out the name of the cue points, I want to do something based on those cue points. So, I'm going to type in if the name is equal to highlight1, then do something. So, I'm going to get rid of that semicolon and add an opening curly brace and when I hit Return, it automatically adds this closing curly brace, because when the video hits this cue point name, what I want to do is I want to turn on the appropriate highlights.
So, I'll say highlight1.visible is equal to true and I'm going to make sure that that takes place at that point in time, but what I need to do initially is make sure highlight1, its visibility is equal to false. So, we turn it off initially, and then when it hits this cue point, turn on that highlight. Same thing for the second highlight, so all I need to do is copy this and paste it.
So, if the cue point is equal to highlight2, then turn off the first highlight and then turn on the second highlight, just like that. And remember, I have to make sure both of them are not visible initially. Okay, so it hits that first cue point, turns on the correct highlight. It hits the second cue point, turns off the first one, turns on that second one and remember as I checkout this video, remember that there's also this end cue point as well, and that's when I'm just going to turn off both of them.
So, let me go back to this first frame here, back into my code and right here, I can copy and paste this last if statement and if the name is equal to end, then turn both of them off, just like that. All right, the code is looking pretty good. I can also comment this code if I want to as well, but in general I know that this controls the highlights.
That's all I'll do right there. But let's go ahead and run this. I'm going to do a Control > Test Movie, and I am given an error right in here. So, let's take a look at this. Looks like there is a misspelling right in here and this will happen on occasion, and I'm glad it did because it's looking for this undefined property, and it's given in my Compiler Errors. So, all I need to do is double-click on that and that takes me right to that line of code that has the issue.
So, I can go ahead and fix that. Obviously I misspelled highlight. I can fix that by removing that extra L that's in there in both places and then I can run my code. Let's go to the About section, the video is going to play, and then now we're going to watch the highlights, highlight and then also turn off. (Female speaker: Hi, my name is Jill Steinman. I'm a freelance graphic designer working in New York City.) (After graduating from Rhode Island School of Design, I immediately started working for various high-profile ad agencies.) (Female Speaker: After five years, I made the move to freelancing full-time.) So, that was just a quick example of having graphics interact with the video, all based on these cue points, and as you can tell, it was quite easy to do in Flash.
- Understanding web design
- Creating buttons and web graphics in Photoshop
- Formatting text with the Text Layout Framework
- Using the Timeline
- Creating a custom looping animation
- Loading images in a gallery
- Creating invisible buttons
- Adding music and video to a site
- Customizing video playback controls
- Optimizing and publishing a web site