With help of this forum I streamlined the level loading process. Localhost worked great all the times.
Then I decided to upload "evening's revisions" to website, and I got this error thrown out:
DOMException [SecurityError: "The operation is insecure."
I have narrowed it down to the file loader.
Is it possible to use this streamlined method with some tweaks or do I have to go back to the old method I had, with 1 event line per file all chosen manually.
Develop games in your browser. Powerful, performant & highly capable.
It's probably the AJAX request. Are you sure your server is set up to allow requests like that?
Ashley it worked before when I had the files manually set up like this:
What do you think? Why would it work like this but not in the streamlined version?
In this we got the filenames from the roll down list, but in the streamlined used another type, that is called URL instead. To me it looks same enough, but maybe different code behind?
No idea, I can't debug a screenshot. As always, sharing a minimal .capx is how these issues get solved.
Ashley Ok, I have now prepared two files.
Working - the old way with awkward events and manually inserting. But it is working!
The new way, streamlined and looking nice in events easier to manage. But only works in Localhost.
Realized now I forgot to remove the webgl effect! But it is easy to remove yourself if it matters.
Interesting, I saw the same error in the "working" example. But the files managed to be opened and read there. Interesting, maybe you can have more input on this one.
I asked my guy and he said I can't change settings of the server because it is a shared webserver service.
Your streamlined example is simply returning 404 not found for the files. Look in the browser console.
In the streamlined version you are loading "Level1.json" but in the manual version you are loading "Level1A.json"
Do both files exist?
Or do you need to change your streamlined version to request:
"Level" & FileNumber & "A.json"
"Level" & FileNumber & ".json"
Ooh!!! I was only looking at the Log portion of Console.
Not found, while in Local it works.
Then I went to the files in the output, and it looks like the process of exporting the files made all of them lowercase! (maybe something to think of, Ashley?) When in the project the files had names with leading versale. Level1.json, Level2.json.
I changed the event to look for "level" not "Level" and it works now on server!
I guess the Local version is more forgiving for the lowercase vs uppercase.
I know. The old version was grabbed from older version of my files and in these I had random file names by all manners such as Test1.json etc.
So in conclusion: the Export process of C2 turns filenames into lowercases. Pay attention to that.
Yay, now I am pleased I can finally upload the game! (after I fixed the bugs of the newly introduced stuff I worked on meanwhile I was waiting on solution here)