Javascript error while changing value to an Array

Bugs will be moved here once resolved.

Post » Sat Dec 05, 2015 3:59 pm

Error while changing value to an array after load from JSON
Javascript error is showm when a value of an array ins changed after it was first filled with a load JSON.

Attach a Capx
https://www.dropbox.com/s/5xxbgdwfjy2pb ... .capx?dl=0

Description of Capx
Just open the project, it will autoload a JSON on an array, and after that, it makes a set value in (0,0,0) = 234;
In chrome you should see a crash, in Firefox in simple doesn't change the value

Steps to Reproduce Bug
    Just open the project

Observed Result
Javascript error or the value is not changed

Expected Result
Change the value in the position indicated.

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)

Operating System and Service Pack
Windows 7 Ultimate

Construct 2 Version ID
216
B
8
S
2
Posts: 42
Reputation: 649

Post » Sat Dec 05, 2015 11:32 pm

I don't think that is a bug. I tried it with another json-file and I had no problem. If you try to get a value from the array you got always a zero. I think the json-file is not correct and cause the problem.
B
24
S
3
G
1
Posts: 423
Reputation: 2,109

Post » Sun Dec 06, 2015 10:54 am

But the Json loads the data correctly, is at the time of changing the value in any position that crashes.

Here you can see the crash:

https://www.dropbox.com/s/epq8kzivone10 ... o.png?dl=0
B
8
S
2
Posts: 42
Reputation: 649

Post » Sun Dec 06, 2015 11:06 am

Okey you were right, I thinnk the JSON vas in 2D and construct 2 requires it in 3D.

If anyone has the same problem, this was my first JSON:

{"c2array":true,"size":[4,4,1],"data":[[0,50,100,150],[0,500,1000,2000],[0,1000,2000,3000],[0,1500,5000,10000]]}

And this is the correct format:

{"c2array":true,"size":[4,4,1],"data":[[[0,50,100,150]],[[0,500,1000,2000]],[[0,1000,2000,3000]],[[0,1500,5000,10000]]]}

You can close it as it is not a bug, thanks everyone!
B
8
S
2
Posts: 42
Reputation: 649

Post » Sun Dec 06, 2015 11:08 am

There is a program to generate arrays. Maybe it's helpful for you:
array-contents-editor-2d-3d-beta_t120926
B
24
S
3
G
1
Posts: 423
Reputation: 2,109


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests