0

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;
Community
  • 1
  • 1
  • Just run it through a localhost server use Wamp or Xampp – K-Alex Jun 10 '16 at 11:42
  • @K-Alex If you mean using a wamp or xampp server for android, I prefer not to; because I want my application run independently. So I solved my problem by developing a simple server by myself and then when going to the game activity, I start that server. It worked perfectly. – Matin Hajatdoost Jun 26 '16 at 06:38

1 Answers1

0

Just run it through a localhost server use Wamp or Xampp

K-Alex
  • 380
  • 1
  • 3
  • 17