Strange problem with arrays emptying unexpectedly

0 favourites
  • 6 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • My project is a video player with a menu to change langage. Text boxes are :

    - Video title "TitreAcceuil"

    - Video subtitle "SoustitreAccueil"

    When you click on a little flag button (subtitlefamily), info in text boxes change to selected langage. Flags have a value (Fr, Bzh, En) for each langage. These values are also related to numbers (1,2, 3) to fetch related info in array.

    When app starts, languages are loaded in an array (InfosArray) from a json (infos.json)

    Here is a screen copy of the code.

    Every thing works fine in preview, html export.

    But when I export to apk, array are loaded then emptied at the same time. I don't know what happens. I have similar projects using arrays that work fine in apk.

    Waht is happening here ???

    I can provide the c3p if needed

    Tagged:

  • Your events for loading the Array JSON look good apart from:

    -Event 1:

    On start of layout "Wait for previous Actions" is not needed there as you dont have any actions after that that need to wait.

    -Event 2:

    Ajax On "InfosVideos" loaded:

    "Wait for previous Actions" is not need it there either as you already waited for the trigger to trigger when the JSON its been loaded and ready with AJAX.

    Though afaik that should have no effect so I would be surprised if that is the source of the issue. You could remove them and test again to see if makes any difference and if not it might be a good idea to share a small example so other users can test it and debug it.

    Normally the first thing I will do is to see if the Array is loaded properly by printing them on the screen the Json after loading it but since you say that it works well on preview and on web export I dont think that could be the issue.

  • Thanks for your suggestion. Apparently, it doesn't work better on tablet.

    Thing is that everything is fine on preview, including remote preview on tablet, but it doesn't work anymore when exported to debug apk

    Here is the source https://www.dropbox.com/s/nipft4w6of41lb3/VideoPlayer_Tablette_4.c3p?dl=0

  • OK, this is verey very tricky. I found where the problem was.

    In the project properties, Export file structure has to be set to 'Folders'. And then everything works.

    I don't know why.

    Any clue about that Ashley ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The export file structure affects how URLs like those used in the AJAX object are used. It's documented in the manual.

    You should use 'Request project file' instead of 'Request URL' as you don't need to type in a URL, which saves you from problems like this.

    You should also always add error events and at least display something if they trigger, because it is so helpful during development. I'd guess the problem was not that it was clearing the arrays, but that it was failing to load anything at all, but you didn't know that because you didn't have anything checking for errors.

  • Thank you Ashley

    Everything was working great but didn't anymore when the project was exported to apk.

    And even in apk, everything worked as if array was loaded, information from array displayed and then array cleared instantly after.

    And how can I implant error checking ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)