How to get values from JSON on every single frame
Hi,
I am a neewby with Animate.
What I want:
A button that changes position based on y numbers pulled from a JSON file.
So for example: on frame 1 the y = 200, on frame 2 the y = 202, on frame 3 the y = 206, etc.
I know how to do this on just one frame:
// load JSON file
var req = new XMLHttpRequest();
req.open("GET", "test.js", true);
req.addEventListener("load", transferComplete.bind(this));
req.send();
//outputJSONfile
function transferComplete(e){
var JSONObject = JSON.parse(req.responseText);
console.log(JSONObject["y"]);
var verticaal = JSONObject["y"];
this.btn.y = verticaal;
}
And my JSON file:
{
"y" : 200
}
But how do I do the same for a JSON file with lets say a 100 different numbers and a 100 frames.
Hopefully someone can help me out!