A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Loading External Files (where do the files go?)

  1. #1
    Senior Member TheLostGuru's Avatar
    Join Date
    Aug 2004
    Location
    I live on this webpage...
    Posts
    784

    Loading External Files (where do the files go?)

    This might be a very naive question, but I have a game that I'm trying to load the music in from external files. Now when the game resides locally on my machine, it's easy. I just specify the folder where the music is. When I upload it on the internet though, the game is going to end up on different websites. Will all of those websites load the music from the same location? Or is there a way to keep the files together? If they all load from the same place, say I upload the files to my personally website, is that going to stress my website to have the files loaded from it constantly?

    Thanks!
    "If I have seen further it is by standing on the shoulders of giants." Isaac Newton
    ------------------------------------------------------------------------------

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    It depends on how you set up your swf, of course. If you load from an absolute URL, such as a fully-specified location on your server (e.g. "http://www.example.com/resources/background.jpg"), then it will always load from that exact url. That would mean that all those different places the game ends up on will hit your server. It will also mean that you will need a rather permissive crossdomain.xml file on your server to allow arbitrary sites to access resources. On the positive side, it will allow you to check your server logs and know which sites are sending requests your way.

    If you use a relative URL (e.g. "/resources/background.jpg"), then all those resources will need to be duplicated on each site. Generally, sites don't allow you to put up arbitrary content along with your game, so this is not a real option.

    Halfway between would be allowing the resource location to be passed in to the swf (and assuming your site if no location is passed in). That way the resources could be duplicated on the hosting site, but if not they will fall back to requesting it from your site.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center