Search code examples
androidconstruct-2

Run game local (file:///) Construct 2


I have a question like the one is asked here in this link: Solution: Run game local (file:///) Construct 2

I did the third step of the solution. I added

self.loadProject(FULL_CONTENT_INSIDE_MY_DATA.JS); return;

just after

xhr.open("GET", datajs_filename, true);
var supportsJsonResponse = false;

in c2runtime.js. But when I test the game in my Android App, I only see the first page of construct; The game cannot be loaded and the first page of construct remains as an image.

A piece of my code:

Runtime.prototype.requestProjectData = function ()
    {
        var self = this;
        var xhr;
        if (this.isWindowsPhone8)
            xhr = new ActiveXObject("Microsoft.XMLHTTP");
        else
            xhr = new XMLHttpRequest();
        var datajs_filename = "data.js";
        if (this.isWindows8App || this.isWindowsPhone8 || this.isWindowsPhone81 || this.isWindows10)
        datajs_filename = "data.json";
        //xhr.open("GET", datajs_filename, true); <-- I commented this line
        var supportsJsonResponse = false;
        self.loadProject(FULL_CONTENT_INSIDE_MY_DATA.JS); return;

Solution

  • Just run it through a localhost server use Wamp or Xampp