Ok, let me explain then. Lets assume you have your main module game.swf that loads some image asset.jpg from the same folder. You test it locally, it works just fine. You put game.html, game.swf and asset.jpg on your site http://niamke.com/ and it still works. Then you publish your game as http://kongregate.com/games/niamke/myniamkegame/ and it suddenly stops loading asset.jpg.
Why
HTTP requests from Flash Player are handled via browser. So the browser gets a request for "asset.jpg" from Flash Plugin instance. There could be all kinds of content (including several Flash Apps) from several different domains within one page, so browser does not bother to figure the correct address out, and plainly tries to load in relatively to the topmost HTML document, basically http://kongregate.com/games/niamke/myniamkegame/asset.jpg which is not there.
How to avoid it
You should create a small piece of code that figures the correct URLs for the files you load. As soon as your content attached to Stage, any display object can access the loaderInfo object which contains the absolute SWF URL.
Usage
Files.parseURL(loaderInfo.url);
var aLoader:Loader = new Loader;
var aRequest:URLRequest = new URLRequest(Files.baseUrl + "asset.jpg");
Loader.load(aRequest);
Implementation
package
{
public class Files
{
// Long live Bill Gates and Windows and backslashes.
static public function figureSlash(value:String):String
{
var aSplit:Array = value.split("/");
var oSplit:Array = value.split("\\");
return (aSplit.length >= oSplit.length)? "/": "\\";
}
static public var baseUrl:String;
static public var systemSlash:String;
// Supposed to dissect the SWF url in order to
// process relative resource file urls properly.
static public function parseURL(value:String):void
{
// Figure correct slash.
systemSlash = figureSlash(value);
// Split SWF URL into Array and remove SWF name.
var aSplit:Array = value.split(systemSlash);
aSplit[aSplit.length - 1] = "";
// Obtain the SWF root folder.
baseUrl = aSplit.join(systemSlash);
}
}
}