Jump to content

Custom loader / delay calling "create" on scene?


Pablo Pirata
 Share

Recommended Posts

Hey all.

I'm trying to fetch some data from a server and only want to start creating the scene with the "create" function after it's loaded. I was able to do it with "this.load.json()" but the problem is that I actually need to send a post request.

I currently have 2 solutions:

- When my request is done, I set a custom attribute and in the update function I check if that attribute exists, if it does, then move to a new scene with the new data.

- When my request is done, I set a custom attribute and in the create function I check if that attribute exists, if it doesn't, then I set a timer to call the create function again and return.

I don't like either solutions.

Is there a way to create a custom loader? Like "this.load.myCustomLoader" and then the "create()" function will only be called after this load is done?

If not, how is the correct way to fetch/post data from a server?

Thank you.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...