How do I iterate in a dynamic list?

120 Views Asked by At

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)

0

There are 0 best solutions below