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

0 favourites
  • 9 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • 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:


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • Catalog is the outermost node:

    <img src="https://dl.dropbox.com/u/20830426/xmlCatalog.png" border="0" />

    "/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.

  • My bad, as I said I don't have much experience with the XML plugin.

  • No worries mate <img src="smileys/smiley1.gif" border="0" align="middle" />

  • 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.

  • Noted, thanks.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)