Multiple external files to arrays [AJAX]

0 favourites
  • 3 posts
From the Asset Store
Human/Character Base Pixel Art Sprites in various poses (nearly 100 files)
  • Hey guys, I've been concerned lately and would really appreciate if someone could clear something up:

    I'm using AJAX to load an array (many, MANY values) from a .json file into an array object once. I also load the kerning of a custom font with it, so I'm not worried right now, but I think I'll be using this plugin for other purposes with several files in the future, loading at any time (dialog, etc...)

    So the thing is: keeping in mind that loading a file isn't instant, will the expression AJAX.lastdata be conflicted when constantly loading different files?

    Should I make loading a file a function that gives a signal when finished to be sure, or am I ovethinking this?

    Or should I just load everything from one file (by using tokenat)? Would it be cpu-expensive?

    In the end, everything ends up in arrays so, is there a hacky alternative to have loaded array objects from the beginning without using AJAX (maybe by tampering with the project files)?

    Any help/info is appreciated.

  • From the manual:


    The contents of the last response. This is set in the On completed trigger. If used in a different event, it contains the response of the last completed request.

    So long as you're loading the data into the Array object in the relevant 'On completed' trigger, the data will not conflict. Basically: you can use LastData outside an 'On completed' trigger, but you REALLY shouldn't.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, I guess I'll redo some of the code to support "on complete"

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