Can not get values of Array which load from JSON

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Problem Description

    I use double loops and to read data for condition , but I can't get values of Array which its data load from .json file.

    This problem occurs in my project , so I created a new project to test , and then there is the same problem in the new project , I think it was not my mistake .

    Attach a Capx ... sp=sharing

    Description of Capx

    In the test.Capx , there are two Arrays,two ProgressBars,an AJAX object and array.json file.

    data of Array1 load from array.json which is requested by AJAX , data of Array2 are generated by random() fuction . Then Using double loops to get values of both Arrays ,and let two ProgressBars adding the values to current progress value .

    Steps to Reproduce Bug

    • Use AJAX to request .json file in project .
    • Create Array then load json string fom AJAX.lastdata .
    • use loops to get value of Array , then try any method (eg. condition) to reference Array .

    Observed Result

    There is weird that I can see values from Array1 in Inspector(load from array.json correctly) , but ProgressBar Can not get the values .

    Expected Result

    ProgressBar Can get the values of Array1,then adding the values to current progress value,showing performance correctly.

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Internet Explorer: YES

    Operating System and Service Pack

    Windows 7 64bit Service Pack 1

    Construct 2 Version ID

    Release 173

  • You have the array format wrong. Download your array2 as json and compare.

  • You have the array format wrong. Download your array2 as json and compare.

    Oh,I know what wrong with it. In inspector,I can't perceive what different with it ,so I don't realize that the format is wrong.

    thanks reply.

  • Closing as not a bug.

  • What's the solution please?

    How do I access JSON data from array, and display in a Text object for instance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • degee147

    This is the 'Closed Bug' section and you should not be posting questions here.

    If you need help, please post your question in the 'How Do I' section, giving as much detail as you can. Including a .capx will generally help with a much quicker response.

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