[SOLVED] How do I fix AJAX delay while rest of events run ?

  • I was trying to parse values from a text file. So when i used AJAX it seems like there is a delay to wait for the request to be completed and during that all the dictionary keys i previously used which i am replacing with AJAX don't get filled for the other events to be run with. This causes the game to not even start. Before this i had used events to set all the dictionary key initial values so it was instant causing no problem. But now what would be the most efficient way to deal with this ? Should i add a flag to everywhere where i am using a dictionary key to solve this to wait for the AJAX request to be completed ?

  • I usually do this:

    On start of layout:

    ...AJAX request "somefile"

    ...Wait for signal "AJAX_Finished"

    ...Enable user interface, do other stuff

    On AJAX "somefile" completed:

    ...Dictionary load from AJAX.LastData

    ...Signal "AJAX_Finished"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks a lot again. It took a bit of experimentation with it yesterday and it's working very well now.

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