0
votes

I am working on some app that loads external swfs from the application directory the problem is that some swf files get loaded correctly and others give ioerror url not found

i put the paths in an array and use a loader to load the path

var arr:Array = ["Games/1.swf", "Games/2.swf"];
var loader:Loader = new Loader();
loader.load(new URLRequest(arr[0]));

this is just example and it is the same in loading all the files but does not work on all files. what would be the problem?

1
What exact files cause an error? - null
The problem is simply that the files are not where they are supposed to be or maybe even not compiled with the app. - BotMaster
they are compiled and in the right path , i got them by directory listing in the debug - Hamada Samir
So, they are where then? application directory / game / 1.swf ? - BadFeelingAboutThis
yes they exist in the path - Hamada Samir

1 Answers

0
votes

Firstly, whenever you load something, listen for the appropriate error events so you know what's going on:

loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);

When using mobile, you should use the app:// shorthand as a reference to the application directory (which I assume is where your Game folder is. Relative paths do not usually work.

So it should look like this:

var arr:Array = ["app://Games/1.swf", "app://Games/2.swf"];

For more information/options, you can look at my answer to this question