[R116]loopindex in XML foreach, error in system.js

Bugs will be moved here once resolved.

Post » Sat Jan 26, 2013 7:44 pm

Link to .capx file (required!):
Sample Capx

Steps to reproduce:
1. Run the sample Capx. An index error in system.js is returned.
2. Disable the sprite foreach loop, no errors are returned.
3. Or invert the disabled actions in condition two (so the text is not using loopindex). This also allows the code to run.

Observed result:
Using loopindex in XML and then again somewhere else on Construct in the same tick causes an index error in system.js.

Expected result:
The loopindex from the XML should not be interfering with the loopindex in the sprite foreach.

Browsers affected:
Chrome: yes
Firefox: yes

Operating system & service pack:
Windows 7.

Construct 2 version:
R116.
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

Post » Sat Jan 26, 2013 8:11 pm

I don't know for sure, but it feels more like an error in your code.
Check your event 2, it's running a loop for a non existing tag in the XML.
IMO that's why you're getting the error.

Better wait for Ash to check this for sure though, I have little experience with the XML plugin.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Sat Jan 26, 2013 8:35 pm

The code should be fine. "/Catalog" is the top most "<Catalog>" node. If you mean because it uses a forward slash, that's from XPATH - it needs the "/" symbol for the first node.
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

Post » Sat Jan 26, 2013 8:47 pm

No I mean there is no <Catalog> node in the XML you give in the start of layout.
Try looking for the node </Track> and there is no more JS issue.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Sat Jan 26, 2013 8:58 pm

Catalog is the outermost node:



"/Track" still returns the error, but make sure you are using /Catalog/Album/Track, not "/Track". If you go straight to "/Track" the XML silently fails (because no such node exist at that path), so it's not actually accessing the loopindex to cause the bug.

Try changing "/Catalog" to "/Catalog/Album/Track" and you should see the error again.
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

Post » Sat Jan 26, 2013 9:26 pm

My bad, as I said I don't have much experience with the XML plugin.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Sat Jan 26, 2013 9:39 pm

No worries mate
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

Post » Mon Jan 28, 2013 3:12 pm

Should be fixed for next build, thanks.

@Kyatric: javascript errors are usually bugs - even if the events are wrong, they should not cause a javascript error and should handle it gracefully instead. A JS error is like a crash in a desktop app.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon Jan 28, 2013 3:48 pm

Noted, thanks.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests