Skip navigation
goodsnow82
Currently Being Moderated

external swfs not loading after embedded on html page?

Jun 14, 2012 3:17 PM

I have a third party swf file that loads other swfs in to it. When I put it on our server and embed it in other pages it no longer loads the external swfs just the main one. When I type the direct link to the swf file in my browser it works fine. So there's something going on where it can't find the other swf files. I'm not sure what could be causing this. Any ideas?

 

Thanks!

 
Replies
  • Currently Being Moderated
    Jun 14, 2012 4:42 PM   in reply to goodsnow82

    If the main swf file is not in the same folder as the html page, that could cause the problem (It is not a problem, but can cause it).  When an swf is embedded into an html page, even if it lives in a different folder, it is essentially in the same folder as the html page when it is displayed in that page.  So anything it targets for loading needs to be targeted as if the swf is in the same folder as the html file.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 15, 2012 1:35 AM   in reply to goodsnow82

    @goodsnow8

     

    Could you provide the code snippet you are using to load swfs ? Also where are you hosting your files.. Sometimes it can also be a hosting restrictions !

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 15, 2012 5:52 AM   in reply to aviPro

    The pathing inside the main .swf is wrong and when placed on the Web pages it can't find the other .swf files.

    When I type the direct link to the swf file in my browser it works fine

    Contrary to what might seem correct, this statement is often the tip-off that the pathing is wrong. If the main .swf is not in the same folder as the Web pages that the .swf is used on.... the .swf should NOT work! The reason for that is that the paths used inside the .swf to load those other .swf files needs to be relative (starting at) the Web page and NOT the physical location of the .swf. The exception to this is if absolute addresses are used to load any other files used by the main .swf.

    For your review:

    Pathing issues

     

    Almost always when it works on the local machine and not the server, it's a pathing problem.
    You can put your Flash related files in whatever folders you want, they do NOT have to be in the root, they do NOT all have to be in the same folder. But if you have a problem and if sticking them all in the root folder works, then you know that the issue was a pathing problem.
    Just remember that paths used in the .swf become relative to the Web page on which the .swf is placed, NOT it’s physical location.  So for example, if your .swf is in the flash/data folder and you use that .swf on a Web page in the root folder, you are in effect, removing that .swf from flash/data and putting it in root. So if the .swf is loading any related files (xml, images, video, etc), the path used inside the .swf to load the .xml file has to be relative to it's new location in root and then back down into flash/data. This is true even though when testing the .swf by itself, it can be inside flash/data and work just fine, since relative to it's location, the path is just fine, they are in the same folder. But if that same path is used when the .swf is placed on a page two folder levels up, the relative path has changed, the old "same folder" path will not work.

    In fact if you are placing the .swf on a web page in a different folder than the .swf is stored in, and that .swf calls external assets, then direct clicking and opening of the .swf in it’s folder should NOT work! That’s because the paths to the external assets should be relative to the Web page and not the physical location of the .swf.
    So just be sure that you use addresses relative to the final Web page locations (not physical file locations) and you can put the Flash related files in what ever folders you want.
    Best wishes,
    Eye for Video
    www.cidigitalmedia.com

    Best wishes,

    Adninjastrator

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points