Save and Load array

Discussion and feedback on Construct 2

Post » Sun Feb 05, 2017 9:00 pm

Dear all,
could you happy me in the following matter: i need an array to store (locally) the score for each level.
I can save array (via array download), but cannot read it back!!!
FileChooser is not appropriate for I do not want user to load this file manually vis FileChooser interface!

Will be very very gratefull!
B
9
S
2
Posts: 34
Reputation: 603

Post » Sun Feb 05, 2017 9:07 pm

I don't know how you saved your Array, but you need to save it with the .AsJSON expression and load it with the "Load" action of the Array.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sun Feb 05, 2017 9:34 pm

scores is my array, i fill it programmically in the lauyout start if there are no "scores" file (when no levels are passed)
I'm doing the following:

1) scores Download as JSON data with filename "scores"
(it dowloads in my download folder on my PC)

2) scores Clear
(for testing)

3)ccores Load from JSON string FileChooser.FileURLAt(0)
no effects ((
B
9
S
2
Posts: 34
Reputation: 603

Post » Sun Feb 05, 2017 9:36 pm

This looks about right, I will need your .capx or a screenshot of those three actions to be able to fix your issue.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sun Feb 05, 2017 11:26 pm

Ok, Sorry - I've found the soloution, Instead of FileBrowser I'm using now LocalStorage
B
9
S
2
Posts: 34
Reputation: 603


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests