Why Won’t my FLV Load on the Web!?
Posted by: Todd Perkins in flash, tags: flash, FLV, Mac, troubleshooting, VideoI often get emails telling me that my training for putting FLV files into Flash doesn’t work as it should once the files are on the web. In other words, people can insert a video into Flash just fine using File > Import > Import Video, and all is well when testing on a computer, but when the files are uploaded to a web server, everything breaks. A few days ago, I was teaching a Flash class and experienced the problem myself after moving my SWF and FLV files into another folder. As soon as I moved them, everything stopped working! What the crap!?
Here’s the problem- when you set the video path for the FLV playback component in Flash on a Mac (only a Mac, not a PC), Flash does not create a relative URL. Instead, Flash tells the FLV Playback component to look for the file in Users/username/somefolder/someotherfolderthatholdsyourFLVfile/flvfile.flv. So, when you move the FLV, the code breaks because Flash is looking in that absolute location (kinda dopey, huh?). Try as you might, it is literally impossible in Flash on a Mac to set a relative path like flvfile.flv for the source of the FLV Playback component. If you type it in the component inspector manually, Flash finds the file and changes it to an absolute path. Quite annoying indeed.
Now the solution- you have to do it with code. It’s really simple code though, so it’s not a huge pain.
- Give the FLV Playback component and instance name (first you have to select it, and then click in the instance name field in the Properties panel).
- Add the code instanceName.source = “flvfile.flv”; (of course, you have to replace instanceName with the actual instance name of your FLV Playback component, and flvfile.flv with the actual name of your movie file).
- Test the movie to create the SWF file that has the relative path.
- Upload the files, and watch everything work in all its majestical majesty.
That’s it!
Entries (RSS)
Hi Todd. This sounds good. One question: I understand where to type in the instance name, but where do I type in the code?
Create a new layer (same frame as the FLV component), select the first frame of the new layer, open the Actions panel, and write the code there.