I 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.

  1. 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).
  2. 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).
  3. Test the movie to create the SWF file that has the relative path.
  4. Upload the files, and watch everything work in all its majestical majesty.

That’s it!

16 Responses to “Why Won’t my FLV Load on the Web!?”
  1. Hi Todd. This sounds good. One question: I understand where to type in the instance name, but where do I type in the code?

  2. 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.

  3. Hello,
    After having lots of problems of having my video load and getting the skint o load with it, I have no clue what I’m doing wrong. I had it working once, but when I changed the skin, it stopped and I have re-created the same thign I did several times and nothing.

    I am on a mac using CS4 and an actionscript 2 file.

    1) I import my .flv file onto my stage.
    2) Set my properties that I want in the Components window.
    3) Make a new layer and add your code above (instanceName.source = “flashflv.flv”;)
    4) Test it (and it works)
    5) Look back on my component file and still see a crazy absolute path instead of just the “flashflv.flv”
    6) Import the SWF into dreamweaver where I need it and nothing. Seems like the video loads (had auto play off, so its just black) and no skin.

    Any suggestions? Am I doing somethign wrong?

  4. I left a comment and its gone???

  5. Why doesn’t adobe correct things like this-sounds like a big programming error to me-and yet another extra step as always-frustrating!

  6. OR you can use xml to source all of your video assets. and that will essentially make everything relative and will always work unless you alter your directory structure.

  7. Todd, You are a amazing teacher, i have watched ALL of your videos on lynda.com. Thank you so much for all of your help and sharing of your knowledge!

    Dan Farthing,
    San Francisco, CA

  8. Just wanted to let you know I struggled with this exact problem for 2 days - searching and searching for an answer and never finding one. I finally figured out the issue myself, but decided I’d better learn some more AS3.0 to see if I was still missing something. After listening to your whole course (very good by the way), and deciding to check out your homepage here - there is the answer. Thank you for being the one place that clearly put it out there!

  9. Thanks for sharing that great idea,,
    am wondering if i used the relative link in swf file to call flv file,,
    what is the advantage and disadvantage of using this way in our case?
    thanx in advenced!!

  10. I would like to request a movie series that tackles JUST PUBLISHING MOVIES and the factors that would help Designers, Artists, Flashster and Clients work together seemlessly communicate projects creatively and successfully publishing awesome new ideas and clients secure in knowing that a time frame, size requirements and cost windows were met. Realtime project experience is good but it’s important to be armed with the best information before getting into a professional project for a client.

  11. Do you have other tutorial on lynda.com about flash??

  12. I heard heard you say this website when i was on chapter 3- 3 of Flash Essential Training

  13. Hey, I found a solution based off your advice using CS4.

    Go to the “component inspector panel” (located under instance name box), change “contentPath” to a relative path (ie blah.f4v), re-publish, and then it will work on your server.

    I have no idea why they use absolute paths for .flv’s and .f4v’s. Bizarre.

  14. I have some trouble USING MovieClips dynamically added using a for loop. They appear on the stage but I can’t modify them.

    I’m not sure if you’ll be able to see the following code but I’ve included for your viewing displeasure! : )

    for (var i:Number = 0; i < 4; i++){
    root["star" + i + "_mc"] = new star();
    addChild(root["star" + i + "_mc"]);

    root["star" + i + "_mc"].scaleX = (i * 0.1);
    root["star" + i + "_mc"].scaleY = (i * 0.1);
    root["star" + i + "_mc"].x = ((i * 10) + (root["star" + i + "_mc"].width));
    root["star" + i + "_mc"].y = ((i * 10) + (root["star" + i + "_mc"].height));

    trace(”i = ” + i);

    }

    Any assistance you can offer would be greatly appreciated
    Cheers!

  15. where do you find the flv component?

  16. I’m nearly a year late, so perhaps some kind of update fixed it in the meantime (nah, I doubt it.. )
    I was embedding video in Flash this week, and indeed, ‘Mac Flash’ appended a very unhelpful ‘/Users/Nicholas/’ etc. to the beginning of the path. All I had to do was edit the pathname twice - enter pathname, click OK, edit again(removing the extraneous path details), click OK - and it stuck. I just uploaded the swf as usual, with the movie files exactly where I wanted them and it worked.

Leave a Reply