0

I'm trying to iterate through a list of objects that I added to a list, but I'm getting an error.

source/PlayState.hx:71: characters 16-21 : Unknown identifier : notes

It says in VS Code that it's because I can't iterate through dynamic lists. Is there any way I can? Here is my code:

    for (note in notes)
    {
        note.y -= 60 * elapsed;
    }

Here is the code that adds them to a list:

    for (note in notesDump)
    {
        var noteType = note.split(".")[0];
        var notePos = note.split(".")[1];
        var newNote = new FlxSprite(0, Std.parseInt(notePos), "assets/images/SP_Note.png");
        notes.push(newNote);
        add(newNote);
    }

(noteDump is a list of all the loaded data in raw form)

wideey
  • 13
  • 3
  • Error is about missing notes, last code uses notesDump. List is iterable as described here https://code.haxe.org/category/beginner/lists.html – Ilir Liburn Sep 21 '22 at 08:59
  • Where do you define the `notes` variable? Maybe it is a local variable that your code can't see. A full reproduction example in https://try.haxe.org/ might be helpful. – Christian Z. Sep 28 '22 at 05:23

0 Answers0