Hello;
I'm building a game where screen information are stored in a JSON.
First screen loaded is "screen_1" on which links can lead to other screens. When a link is clicked, next screen name is stored in a variable nextScreen and I'd like to perform a search in the JSON to check which level is this next screen and display according information
Here is the JSON
{
"screens": [
{
"id": "screen_1",
"elements": [
{
"type": "text",
"id": "instructions",
"content": "Screen 1 flashing section egestas."
}
]
},
{
"id": "screen_2",
"elements": [
{
"type": "text",
"id": "instructions",
"content": "Screen 2 flashing section egestas."
}
]
},
{
"id": "screen_3",
"elements": [
{
"type": "text",
"id": "instructions",
"content": "Screen 3 flashing section egestas."
}
]
}
]
}
So far I managed to load the JSON correctily using AJAX. I can display info using the correct path but I've a hard time building the loop "for each" that search the next screen name through the JSON and display related information.
I tried to add to the foreach loop something like :
{...}JSON - For each entry in "screens"
System - JSON.Get ("screens."&LoopIndex&".id") = nextScreen
but it doesn't work...